Skip to content

Raspberry Pi Pico#

Prerequisites#

Install the ARM toolchain: Install ARM Cross-Compiler

Install picotool: Install Picotool

Setup#

Clone and initialize submodules:

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

Building#

Configure and build:

cmake -Bbuild
cmake --build build -j $(nproc)

This creates build/Blink.elf.

Flashing#

Put the Pico into BOOTSEL mode (hold BOOTSEL while connecting USB), then:

picotool load -x build/Blink.elf

Changing the Application#

Edit LF_MAIN in CMakeLists.txt or via command line:

cmake -Bbuild -DLF_MAIN=Timer
cmake --build build -j $(nproc)

Log Level#

cmake -Bbuild -DLOG_LEVEL=LF_LOG_LEVEL_DEBUG

Board Variants#

For Pico 2 (RP2350):

export PICO_BOARD=pico2
cmake -Bbuild

For Pico W:

export PICO_BOARD=pico_w
cmake -Bbuild

Cleaning#

rm -rf src-gen build

Network Channels#

Channel Mode Description
UART Polled Serial point-to-point