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.

Raspberry Pi Pico Rust RT-Thread FreeRTOS

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

Subscribe
Notify of
guest
12 Comments
oldest
newest
Anonymous
Anonymous
3 months ago

*Microsoft GitHub. Microsoft Pi.

http://techrights.org/2021/02/02/microsoft-pi/

Jean-Luc Aufranc (CNXSoft)
Admin

Yes, I’ve seen this. That’s because Microsoft Visual Studio Code is used to program Raspberry Pi Pico from the Raspberry Pi SBC. I’m not even sure it’s installed by default, because Pico instructions still say VS Code must be installed manually.

Tuff Professional
Tuff Professional
3 months ago

Has anyone used a final product with Rust? Normally the IoT people that i worked with was against using differenct languages other than Python or C. Hell, i worked in a project that the manager didnt even let me use C++

Mbus Roque
3 months ago

Normally the IoT people that i worked with was against using differenct languages other than Python or C.

Hum…. probably startups, with sub 30 old devs….
C is perfectly good for embedded, you just need to know what you are doing..
Rust is like training wheels, it’s cute, but after a couple of years in the industry, you should not need to use them…

.

dgp
dgp
3 months ago

>Rust is like training wheels, it’s cute, but after a couple of >years in the industry, you should not need to use them… This is anecdotal but I find that people that think they are better than tools written by many people to solve common issues that almost everyone makes are very often the source of the bugs that the tools are trying to avoid. Let’s say rust is “training wheels” that avoids common errors that happen in C. If rust didn’t need special runtime support, generated code with the same footprint, and was a supported language for what you’re… Read more »

Tim
Tim
3 months ago

Embedded compiler writers enforce some of the benefits of Rust which lessens the benefits, but you are right that if Rust could match C then it would be the obvious choice.

Michael
1 month ago

And after a decade or two in the industry one realises the sad truth. One sees many systems crash and burn through simple memory use errors, made by developers of all experience levels. One has spent countless hours on long and head scratching debugging sessions, long after the developer team has been disbanded. One has seen very expensive investigations into problems after products have been deployed. Eventually one realises that those training wheels are a very good idea. For all developers all the time. When they have zero impact on program size or execution speed to reject such help toward… Read more »

Bonzadog
Bonzadog
3 months ago

I will have a look at RUST, But at the moment I am looking t ERLANG for RPi usage. Has anyone used ERLANG & RUST to be able to compare?

zoobab
3 months ago

FreeRTOS means Arduino IDE support soon?

Jean-Luc Aufranc (CNXSoft)
Admin

Arduino IDE support is coming in any cases since Arduino is making an RP2040 board. It should not take long since they posted some photos of the boards on Twitter yesterday.

zoobab
3 months ago

Just made a Dockerfile to build the whole thing:

https://github.com/zoobab/RPI-pico-FreeRTOS/blob/master/Dockerfile

dgp
dgp
3 months ago

Probably not the right thread for this but:

https://twitter.com/mangopi_widora/status/1359679127373062145

hohoho!

Advertisements