The popular real time operating systems (RTOS), known as FreeRTOS, now supports symmetric multiprocessing (SMP).
What is SMP you ask?
SMP allows one instance of the FreeRTOS kernel to schedule tasks across multiple identical processor cores. The core architectures must be identical and share the same memory. The Raspberry Pi RP2040 chip is ideal for this task as the two identical Arm Cortex M0+ cores share the same SRAM. SMP increases the possible throughput of the system, as there are multiple processors, more processes are executed. Symmetric multiprocessing systems are also more reliable than single processor systems as the system can still run if a processor fails, albeit with a performance hit. So FreeRTOS can be run on both cores of the RP2040.
The FreeRTOS documentation contains examples of SMP programs for the RP2040. They are available here. These examples include:
- A blinky demo which uses two tasks and one queue to toggle an LED.
- A comprehensive test and demo application that demonstrates; message buffers, stream buffers, task notifications, queues semaphores, timers etc.
- A multicore demo which runs FreeRTOS tasks on one core which interacts with the code running on the other core using Raspberry Pico SDK synchronization primitives.
Keep an eye on our projects page, as we are going to have a tutorial released shortly discussing how to implement FreeRTOS SMP in your projects.