Symmetric Multiprocessing Branch of FreeRTOS Gets Ported to the Raspberry Pi Pico, RP2040

Newly-launched branch of the real-time operating system can now make full use of the two Arm Cortex-M0+ cores on the RP2040.

Raspberry Pi developer and performance architect Graham Sanderson has put together a port of the newly-unveiled FreeRTOS symmetric multiprocessing (SMP) branch for the Raspberry Pi Pico and compatibles — allowing the real-time operating system to make use of both cores of the RP2040.

"Adds support for RP2040 using the Raspberry Pi Pico SDK," Sanderson writes of his since-merged pull request to the FreeRTOS project. "FreeRTOS can be run on either core. SDK semaphores, queues, mutexes, and sleep functions can be used freely to/from FreeRTOS tasks and can be used to interact with code running on the other RP2040 core."

"The entirety of this change is located within the RP2040 port except for the new portSTACK_LIMIT_PADDING define (which is only used by stack overflow checking). This is added to allow a port to keep extra state for the switched out task below the normal 'top' of stack location. This allows extra information to be saved on the stack without disrupting a debuggers ability to parse the stack frame."

Unveiled late last month, the SMP branch of the FreeRTOS project adds support for symmetric multiprocessing — allowing the operating system to make use of multi-core processors, rather than being limited to running on a single core.

"We are really pleased to work with XMOS and other partners to consolidate and upstream the various symmetric multiprocessing versions of FreeRTOS into the officially supported kernel version," said FreeRTOS founder Richard Barry at the time. "This enables us, as well as our expansive user community, to provide the same rapid and knowledgeable level of support across an even wider range of innovative processors and use cases."

Sanderson's work has now been merged into FreeRTOS, though you won't find it as part of the standard build: All SMP work takes place on a separate branch, unsurprisingly labelled "smp," published to the FreeRTOS GitHub repository under the same permissive MIT license as the non-SMP variant.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire:
Related articles
Sponsored articles
Related articles