Skip to content

Raspberry Pi Pico

lbuild config: modm: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

Configuration

<library>
  <options>
    <option name="modm:target">rp2040</option>
    <option name="modm:platform:core:boot2">w25q080</option>
    <option name="modm:platform:core:boot2_size">2Mi</option>
  </options>
  <modules>
    <module>modm:board:rp-pico</module>
  </modules>
</library>