FreeRTOS-SMP Kernel is still being tested.
This page documents demos that use the FreeRTOS symmetric multiprocessing (SMP) version. The demos target the Raspberry Pi Pico board, which uses the RP2040 microcontroller from Raspberry Pi featuring 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.
Please read all the following points before using this RTOS port.
Also see the FAQ My application does not run, what could be wrong?
The project files for this demo are located in the FreeRTOS/Demo/CORTEX_M0+_RP2040
directory of the FreeRTOS SMP Demo Git repository.
FreeRTOS Port files compiled in the project are in the
FreeRTOS/Source/portable/ThirdParty/GCC/RP2040
directory.
The project includes the following demos:
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.
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.
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.
PICO_SDK_PATH
is set in your environment, or pass it via
-DPICO_SDK_PATH=xxx
on the CMake command line.$ cd FreeRTOS/Demo/CORTEX_M0+_RP2040
$ mkdir build
$ cd build
$ cmake ..
$ make
This will generate .uf2
files for each demo application:
FreeRTOS/Demo/CORTEX_M0+_RP2040/build/Standard/main_blinky.uf2
.FreeRTOS/Demo/CORTEX_M0+_RP2040/build/Standard/main_full.uf2
FreeRTOS/Demo/CORTEX_M0+_RP2040/build/OnEitherCore/on_core_zero.uf2
FreeRTOS/Demo/CORTEX_M0+_RP2040/build/OnEitherCore/on_core_one.uf2
BOOTSEL
button. This will force the board into USB Mass Storage Mode..uf2
file for the demo you want to run onto the Mass
Storage Device.FreeRTOS/Demo/CORTEX_M0+_RP2040/Standard/FreeRTOSConfig.h
and those specific
to the multicore demo are contained in FreeRTOS/Demo/CORTEX_M0+_RP2040/OnEitherCore/FreeRTOSConfig.h
.
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:
configNUM_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.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。