Skip to content

Raspberry Pi Pico

lbuild module: modm:board:rp-pico

RP2040 Official System Development Board See https://www.raspberrypi.com/products/raspberry-pi-pico

Programming

UF2

The RP2040 ships with a UF2 bootloader in ROM.

To upload your application, connect the RP2040 via USB, convert the ELF to UF2 format by calling scons uf2 or make uf2 and copy the generated .uf2 file to the mounted virtual disk.

OpenOCD

Another option is to use Picoprobe and custom version of OpenOCD provided by RPi.

You would need to build and program one of the boards with the Picoprobe firmware, configure and build RPi OpenOCD, and connect the boards via SWD. The wiring diagram and detailed description is available in the Pico Documentation.

The how-to shows steps for building and installing the RPi OpenOCD into your system globally, however, if you still want to be able to work with other OpenOCD binaries, you should only install it locally:

sudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev

cd ~/pico
git clone https://github.com/raspberrypi/openocd.git --branch rp2040 --depth=1 --no-single-branch

cd openocd
./bootstrap

mkdir build
cd build
../configure --enable-picoprobe --prefix=$(realpath ../install)

make -j4
make install

Additional steps are needed to get access to the device from a non-privileged user on Linux. Edit or create the /etc/udev/rules.d/60-openocd.rules file and append these lines to it:

# Raspberry Pi Picoprobe
ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", MODE="660", GROUP="plugdev", TAG+="uaccess"

Once you have both of your Pico boards connected according to the wiring diagram, you can run scons program to program the dev board:

export MODM_OPENOCD_BINARY=$HOME/pico/openocd/install/bin/openocd
scons program

This module is only available for rp2040.

Dependencies

modm:board:rp-pico modm_board_rp_pico modm: board: rp-pico modm_platform_clock modm: platform: clock modm_board_rp_pico->modm_platform_clock modm_platform_clockgen modm: platform: clockgen modm_board_rp_pico->modm_platform_clockgen modm_platform_core modm: platform: core modm_board_rp_pico->modm_platform_core modm_platform_gpio modm: platform: gpio modm_board_rp_pico->modm_platform_gpio modm_platform_usb modm: platform: usb modm_board_rp_pico->modm_platform_usb

Limited availability: Check with 'lbuild discover' if this module is available for your target!