Raspberry Pi Pico Gets supports for Rust, RT-Thread OS and FreeRTOS

In January end, we saw the launch of Raspberry Pi Pico equipped with an RP2040 dual-core Cortex-M0+ microcontroller working up to 133 MHz with official support for MicroPython and C.

In this feature, we will be discussing the Raspberry Pi Pico’s flexible software support compatible with RP2040 MCU, apart from the MicroPython, C/C++, and upcoming Arduino IDE software support. We will specifically be focusing on Rust, RT-Thread OS, and FreeRTOS support for Raspberry Pi Pico.

Rust Code Running on Raspberry Pi Pico

Rust language is considered fast, reliable, and secure when it comes to IoT gateways. It also opens up the option for writing extremely low-level code, such as operating system kernels or microcontroller applications.  Porting Rust with RP2040 for working with Raspberry Pi Pico was seen in Jonathan Pallant’s Twitter Feed.

The RP2040 comes with an external QSPI flash. The internal mask-ROM reads the programs from the external flash and uses it at top of SRAM (0x2004_lf00) using a bootloader. Hence, the programs are a 256-byte block for reconfiguration of the XIP_SSI interface with appropriate values of the QSPI flash. This configures the system for the QSPI flash starts from the address 0x1000_000 from upwards. For more information visit the GitHub repository.

Jonathan also explains how the code would have to be built:

Running of the “cargo build –release”, then using the elf2uf2 tool from the pico-sdk creates a UF2 file. This can then be copied to the emulated mass storage device created by the ROM bootloader. It should be ready for flashing out with an SWDv2 compatible probe (like a second Pico running picoprobe firmware).  Working with the regular Arm probe requires the SWDv2 support and something that understands how the dual M0+ cores are connected.

There might also be a  need to build a PAC with svd2rust or change the Cargo.toml to point to a copy of GitHub – there are several.

RT-Thread OS on Raspberry Pi Pico

RT-Thread OS is an open-source real-time operating system (RTOS) dedicated to embedded applications and IoT devices, and compatible with various architectures “ranging from x86 and Arm to RISC-V and Xtensa, is supported on the RP2040 — and, by extension, on RP2040-based development boards including the Raspberry Pi Pico.”

RT-Thread Studio IDE supports the Raspberry Pi Pico’s RP2040 MCU for the target projects and can be downloaded from the company website. The development steps involve the download of PICO BSP from the SDK Manager of the IDE. Users can then create a new RT-Thread project and select the PICO board to work with Raspberry Pi Pico.

For detailed information to get started with RT-Thread OS you can watch the tutorial video above, or read RT-Thread’s article on Medium with screenshots for getting started. You can also get support in the forum

FreeRTOS Example for Raspberry Pi Pico

FreeRTOS is a popular open-source real-time operating system (RTOS) for microcontrollers and small microprocessors distributed under the MIT open source license.

There are not many resources available online about the support of FreeRTOS for Raspberry Pi Pico. However, Reddit thread draws our attention to a FreeRTOS Example for Raspberry Pi Pico that is hosted on GitHub. The operating system can be used in a conventional way for raspberry pico projects with CMake. 

The discussion includes some insightful parts, including “the use of CM0 port for standard FreeRTOS kernel without modifications that solves the issue of dealing with portable parts”, and one person is also interested in porting Zephyr OS to Raspberry Pi Pico.

Support CNX Software - Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples
Notify of
newest most voted