Skip to content

Kind of generic template for FreeRTOS on the Raspberry Pi RP2040 Pico

Notifications You must be signed in to change notification settings

crstrand/PicoRTOS

Repository files navigation

RP2040 Pico FreeRTOS Application Template

This is a template you may use to start a FreeRTOS application for the RP2040 Pico board.
It only uses FreeRTOS single core.
The template app will only echo characters on one (or more if configured) USB serial ports.
FreeRTOS Symmetrical MultiProcessing (SMP) is a whole OTHER pain adventure

Prerequisites

2 RaspberryPi RP2040 Picos

Learn cmake. I'm not kidding. It will be SUPER painfull if you don't.

Follow some RP2040 Pico tutorials to get your build environment set up. Like this one from DigiKey
This one will help setup VSCode and a spare Pico as a picoprobe debugger (VERY handy)

Learn FreeRTOS.
Follow some FreeRTOS YouTube tutorials like this one from Learn Embedded Systems

Getting started

Clone RP2040 SDK
and FreeRTOS Kernel
into generic and accessible directories. I used C:\Users\Public\...
Set environment variables: PICO_SDK_PATH and FREERTOS_KERNEL_PATH to point to the appropriate directories.
pico_sdk_import.cmake will then take care of finding the Pico SDK files for you.
FreeRTOS_Kernel_import.cmake will include those files for you.

Gotchas

If you enable any of the "hook" options in FreeRTOSConfig.h, you MUST create them in freertos_hook.c or you will get errors.

Compiling

In a MinGW bash window (Git Bash):

mkdir build
cd build
cmake -G "MinGW Makefiles" ..

the cmake command above will look one directory up for the CMakeLists.txt file and create all the files required to 'make' the application in the current directory (./build).
While in ./build

make -j4  # use 4 threads to compile.  You can try more (8?) if you like

If all went well, you should be rewarded with 6 files:

picoRTOS.bin
picoRTOS.dis
picoRTOS.elf
picoRTOS.elf.map
picoRTOS.hex
picoRTOS.uf2

If you don't know what to do with those files by now, you really shouldn't be trying this 😇

About

Kind of generic template for FreeRTOS on the Raspberry Pi RP2040 Pico

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published