This is a written expleanation of the video tutorial on how to get started with FreeRTOS on the Raspberry Pi Pico
This uses picosdk (SDK 1.5.1) and FreeRTOS (V11.0.1)
git clone https://github.com/lowlevellearning/rp2040-freertos
cd rp2040-freertos
We need to add the PICO-SDK and FreeRTOS to the project.
This is dependend on your setup. If you have the PICO-SDK installed, you may need to add the path to the PICO_SDK_PATH
to point to the location of the SDK.
export PICO_SDK_PATH=/path/to/pico-sdk
If you don't have the SDK installed, you can clone it from the official repo.
git clone https://github.com/raspberrypi/pico-sdk
export PICO_SDK_PATH=$PWD/pico-sdk
You may also need to install the toolchain. You can find the instructions for that in original video or in the getting-started PDF
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel
cd FreeRTOS-Kernel
git checkout V11.0.1
cd ..
cd build
rm -rf * # This nukes the entire build folder, to have a clean slate
cmake ..
# -j4 means that it will use 4 threads to compile, this can be modified to your liking
make -j4
Unplug the Pico, press and hold the BOOTSEL button, plug the Pico back in, release the BOOTSEL button. The Pico should now appear as a USB drive on your computer. By copying a file to this drive you can flash the program to the Pico.
This can be done via drag and drop or:
cp blink.uf2 </path/to/pico>
(were </path/to/pico>
is the path to the USB drive)
Use FreeRTOS V11.0.1 (commit: 0240cd5) instead of V11.1.0 (commit: dbf7055) by running git checkout 0240cd5
in FreeRTOS-Kernel
folder
Currently (Jun 22, 2024) freertos is not working correctly with the rpi pico since release V11.1.0 (commit: dbf7055).
When trying to build the project will get this error
error: #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU
when doing so by adding #define configENABLE_MPU 0
or #define configENABLE_MPU 1
to the FreeRTOSConfig.h
file, the following error will appear in multiple freertos related files:
tasks.c:(privileged_functions+0xecc): undefined reference to `vClearInterruptMask'
This issue can be avoided by using the older version of FreeRTOS: V11.0.1 (commit: 0240cd5)
You can just checkout the correct version by running:
git checkout 0240cd5
This will checkout the correct version of FreeRTOS. You can now build the project as usual.