Download FreeRTOS

Quality RTOS & Embedded Software

FreeRTOS-Plus-TCP now has unified IPv4 and IPv6 functionalities and multi-interface support.
Achieving Unbrickable MCU FOTA for your FreeRTOS-powered Firmware:
FreeRTOS 202012 LTS end of support announced.
FreeRTOS website now available in Simplified Chinese
New FreeRTOS Long Term Support version now available.

SMP Demos for the Raspberry Pi Pico Board


These demos use the FreeRTOS symmetric multiprocessing (SMP) version of the kernel. The demos target the Raspberry Pi Pico board, which uses the RP2040 microcontroller from Raspberry Pi that features a Dual-core ARM Cortex M0+ processor.

These demo applications use the GNU ARM Embedded Toolchain to build the FreeRTOS Raspberry Pi Pico port. They demonstrate support for Symmetric Multiprocessing (SMP) in the FreeRTOS Kernel.

Source Code Organization

The project files for this demo are located in the FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040 directory of the FreeRTOS Git repository. FreeRTOS Port files compiled in the project are in the FreeRTOS/Source/portable/ThirdParty/GCC/RP2040 directory.

The Demo Applications

The project includes the following demos:

  1. Blinky Demo.
  2. Comprehensive Demo.
  3. Multicore Demo.

Blinky Demo

The blinky demo uses two tasks and one queue.

  • The Queue Send Task:

    The queue send task is implemented by the prvQueueSendTask() function. The task sits in a loop and sends the value 100 to the queue every 1000 milliseconds (1 second).

  • The Queue Receive Task:

    The queue receive task is implemented by the prvQueueReceiveTask() function. The task sits in a loop that blocks on attempts to read from the queue (no CPU cycles are consumed while the task is blocked), and toggles an LED each time the value 100 is received from the queue send task. As the queue send task writes to the queue every 1000 milliseconds, the queue receive task unblocks and toggles the LED every 1000 milliseconds.

Comprehensive Demo

The comprehensive demo implements a comprehensive test and demo application that, among other things, demonstrates and/or tests:

The created tasks are from the set of standard demo tasks that are used by all FreeRTOS port demo applications. They have no specific functionality, but are created just to demonstrate how to use the FreeRTOS API, and test the RTOS port.

A "check" task is created that periodically inspects the standard demo tasks (which contain self monitoring code) to ensure all the tasks are functioning as expected. The check task toggles the LED each time it executes. This gives visual feedback of the system health. If the LED is toggling every 3 seconds, then the check task has not discovered any problems. If the LED is toggling every 200 milliseconds, then the check task has discovered a problem in one or more tasks.

Multicore Demo

The multicore demo application runs FreeRTOS tasks on one core which interacts with the code running on the other core using Raspberry Pico SDK synchronization primitives. There are two versions of the same demo - One version runs FreeRTOS on core 0, the other runs FreeRTOS on core 1.

Building and Running the RTOS Demo Applications


  1. Setup the Raspberry Pi Pico SDK build environment by following the instructions for Getting Started With Pico. Ensure that PICO_SDK_PATH is set in your environment, or pass it via -DPICO_SDK_PATH=xxx on the CMake command line.

  2. Run the following commands:

    $ cd FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040
    $ mkdir build
    $ cd build
    $ cmake ..
    $ make 

    This will generate .uf2 files for each demo application:

    • Blinky Demo - FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040/build/Standard_smp/main_blinky_smp.uf2.

    • Comprehensive Demo - FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040/build/Standard/main_full_smp.uf2

    • Multicore Demo

      • FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040/build/OnEitherCore/on_core_zero.uf2
      • FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040/build/OnEitherCore/on_core_one.uf2


  1. Connect the Raspberry Pi Pico to your computer while holding the BOOTSEL button. This will force the board into USB Mass Storage Mode.
  2. Drag-and-drop the .uf2 file for the demo you want to run onto the Mass Storage Device.

RTOS Configuration and Usage Details

  • Configuration items specific to the blinky and comprehensive demos are in the FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040/Standard_smp/FreeRTOSConfig.h file and those specific to the multicore demo are in the FreeRTOS/Demo/Community-Supported-Demos/CORTEX_M0+_RP2040/OnEitherCore/FreeRTOSConfig.h file. The constants defined in these files can be edited to suit your application. The following configuration options are specific to the SMP support in the FreeRTOS Kernel:
    • configNUMBER_OF_CORES - Set the number of cores.
    • configRUN_MULTIPLE_PRIORITIES - Enable/Disable simultaneously running tasks with multiple priorities.
    • configUSE_CORE_AFFINITY - Enable/Disable setting a task's affinity to certain cores.
  • Source/Portable/MemMang/heap_4.c is included in the project to provide the memory allocation required by the RTOS kernel. Please refer to the Memory Management section of the API documentation for complete information.
  • vPortEndScheduler() has not been implemented.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.