Skip to content

pico-jxglib

A collection of libraries and tools for Raspberry Pi Pico, including a powerful shell and various utilities like built-in logic analyzer to enhance your development experience.

Pico Models

Motivation

Why firmware platforms have no interactive shell? When you want to modify the behavior of the firmware, you have to edit the source code, compile it, and flash it to the device. This process can be time-consuming and inefficient, especially for small changes or debugging purposes. An interactive shell allows developers to interact with the firmware in real-time, making it easier to test and modify behavior without the need for recompilation.

Yes, I know there are some interactive shells for microcontrollers, but most of them come with OS like FreeRTOS, and they are not designed for bare-metal firmware. I love bare-metal programming, and I want my programs to run as fast as possible without the overhead of an OS.

pico-jxglib aims to provide a simple but powerful interactive shell with just four lines of additional code.

Sample Programs

pico-jxglib is implemented in C++, but it also provides C APIs for those who prefer C. The following sample programs show how to use the library in both C++ and C.

#include "pico/stdlib.h"
#include "jxglib/LABOPlatform.h"

using namespace jxglib;

int main(void)
{
    ::stdio_init_all();
    LABOPlatform::Instance.Initialize();
    for (;;) {
        // Your code here
        Tickable::Tick();
    }
}
#include "pico/stdlib.h"
#include "jxglib/LABOPlatform.h"

int main(void)
{
    stdio_init_all();
    jxglib_labo_init(true);
    for (;;) {
        /* Your code here */
        jxglib_tick();
    }
}

Just adding the highlighted lines makes your firmware interactive through USB's serial connection, providing a bash-like interface to execute many powerful built-in commands for various purposes. Learn More

Of course, you can also add your own custom commands to the shell. It's that simple!

pico-jxgLABO: Ready-to-Flash UF2 Binary

If you want to try it out without setting up the development environment, you can download the ready-to-flash UF2 binary files.

Target Board UF2 Binary File
Raspberry Pi Pico pico-jxgLABO.uf2
Raspberry Pi Pico W pico-w-jxgLABO.uf2
Raspberry Pi Pico2 pico2-jxgLABO.uf2
Raspberry Pi Pico2 W pico2-w-jxgLABO.uf2

These UF2 files are pre-compiled with the latest version of pico-jxglib and can be flashed to your Pico board using the standard UF2 flashing method. Just put your Pico into bootloader mode, copy the UF2 file to the mounted drive, and you're good to go! You can then connect to the Pico's serial console to access the interactive shell and start exploring its features.

Built-in Logic Analyzer

While the library also comes with a rich set of built-in commands for various purposes, the most exciting feature is the built-in logic analyzer. No need to prepare and connect a logic analyzer. The Pico board that runs your firmware works as a logic analyzer!

The wave form can be visualized by two methods:

  • Print it as text in the shell. This is a simple and quick way to visualize the data without needing any additional tools. Learn More

  • Visualize it using PulseView, a powerful waveform viewer. This allows you to see the captured data in a more detailed and interactive way, making it easier to analyze complex signals and timing relationships. Learn More

Below is a demo of the logic analyzer working on the shell, capturing the I2C signals that issue READ requests for scanning devices. Please note that all the commands executed in the prompt L:/> are processed by the Pico firmware without the involvement of the host computer.

Other Features

In addition to the interactive shell and built-in logic analyzer, pico-jxglib also provides a variety of other features, including:

  • Wi-Fi Configuration by Shell


    If you're using a Pico W or Pico2 W, you can configure the network settings, like SSID and password, easily from the shell. No program needed!

    Learn More

  • Remote Shell


    You can remotely access the shell over the Wi-Fi network using Telnet protocol, allowing you to interact with your Pico from anywhere without needing a physical connection.

    Learn More

  • Display Support


    The library provides support for various displays such as OLED and TFT displays. You can use the shell to configure the display and draw images on the screen. WS2812 RGB LEDs can also be used as a display, allowing you to create colorful lighting effects and visualizations directly from your firmware and the shell.

  • File Operations


    You can use the flash memory of the Pico as a file system to store and manage files. This allows you to read and write files directly from your firmware, making it easier to manage data and configurations. File operating commands, such as ls, cp, mv, rm, mkdir, and cat, are built into the shell, allowing you to manage files directly from the command line interface.

    Learn More

  • Pico as USB Mass Storage Device


    The file system is also accessible as a USB mass storage device when the Pico is connected to a computer. This means you can easily transfer files between your computer and the Pico without needing additional software or tools.

    Learn More

  • USB Keyboard and Mouse Support


    You can also connect a USB keyboard and mouse to your Pico, allowing you to interact with the shell and control the display directly from the connected peripherals.

    Learn More

  • SD Card Support


    You can also use an SD card with your Pico. The library provides support for SD cards, allowing you to read and write files on the SD card from your firmware.

    Learn More

  • External USB Storage Device Support


    In addition to the built-in flash memory and SD card support, pico-jxglib also allows you to connect external USB storage devices to your Pico. This means you can use a USB flash drive or an external hard drive to store and manage files directly from your firmware.

  • Standalone Shell


    The shell can also use an OLED or TFT display as an output device and a USB keyboard as an input device, allowing you to use the shell without needing a computer connection. This can be useful for standalone applications where you want to interact with the firmware directly from the device itself.

  • Camera Support


    The library provides support for the OV7670 camera module, allowing you to capture images and video directly from your Pico. You can use the shell to configure the camera settings and capture images, which can then be saved to the file system or displayed on a connected display.

    Learn More

  • Real-Time Clock (RTC)


    The library also provides support for a real-time clock, allowing you to keep track of time and date in your firmware. You can use the shell to set and read the RTC, which can be useful for applications that require timekeeping or scheduling.

    Learn More

  • TFLite Micro Support


    The library also provides support for TensorFlow Lite Micro, allowing you to run machine learning models directly on your Pico. A C macro that includes tflite files allow you to easily integrate TFLite Micro models into your firmware.

  • LVGL Support


    The library also provides support for LVGL, a powerful graphics library for embedded systems.

    Learn More

  • PIO Assembler


    You can write PIO assembly code directly in the C++ code and use it in your firmware, allowing you to take advantage of the powerful PIO capabilities of the Pico without needing to write separate assembly files.

  • GPIO Control


    You can control the GPIO pins of the Pico directly from the shell, allowing you to easily toggle pins and read their states.

    Learn More

  • PWM Control


    The library also provides support for PWM (Pulse Width Modulation), allowing you to control the brightness of LEDs, the speed of motors, and other devices that can be controlled with PWM signals directly from the shell.

    Learn More

  • I2C and SPI Communication


    The library provides built-in commands for I2C and SPI communication, making it easy to interact with a wide range of sensors and peripherals without needing to write complex code.

  • USB Device Support


    No more bothering about USB descriptors of the TinyUSB! You can easily make your Pico act as a USB device, such as serial device, mass storage device, video, keyboard, or mouse. Combining these functions is also easy!

  • USB Host Support


    The library provides wrapper APIs for the TinyUSB host stack, allowing you to easily connect and interact with USB devices such as keyboards, mice, and storage devices directly from your Pico firmware.

And much more!

The library is continuously being developed and new features are added regularly. Be sure to check the documentation and release notes for the latest updates and features.

License

pico-jxglib is licensed under the MIT License.