Skip to content

FreeRTOS#

Supported Platforms#

The FreeRTOS template currently supports:

  • Pico (RP2040/RP2350) - Raspberry Pi Pico and Pico 2

Setup#

Clone and initialize submodules:

git clone https://github.com/lf-lang/lf-freertos-uc-template.git my-project
cd my-project
git submodule update --init --recursive

Install the ARM toolchain as described in the Pico platform prerequisites.

Building#

mkdir build && cd build
cmake -DPLATFORM_TARGET=pico ..
make

Flashing (Pico)#

Put the Pico into BOOTSEL mode, then:

picotool load -x bin/Blink.elf

Project Structure#

lf-freertos-uc-template/
├── CMakeLists.txt
├── platforms/
│   └── pico/
│       ├── FreeRTOSConfig.h
│       ├── platform.cmake
│       └── README.md
├── src/
│   ├── Blink.lf
│   ├── HelloFreeRTOS.lf
│   └── Timer.lf
└── FreeRTOS/                # Submodule

Platform Configuration#

Each platform has its own FreeRTOSConfig.h for tuning:

  • CPU clock: 133 MHz (Pico default)
  • Tick rate: 100 Hz
  • Heap size: 128 KB

Adding New Platforms#

  1. Create platforms/<platform-name>/
  2. Add platform.cmake with platform-specific CMake configuration
  3. Add FreeRTOSConfig.h tuned for your hardware
  4. Optionally add FreeRTOS hooks in <platform>_freertos_hooks.c

Pico-Specific Features#

  • USB and UART stdio enabled by default
  • Pico W WiFi libraries automatically linked
  • Connect GPIO 0 (TX) and GPIO 1 (RX) for UART output