EasyManua.ls Logo

Raspberry Pi Pico Series - Debug with Openocd; Debug with SWD

Raspberry Pi Pico Series
54 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
$ minicom -D /dev/tty.usbmodem1234561 -b 115200
Debug with OpenOCD
With Debug Probe, you can load binaries via the SWD port and OpenOCD.
First, build a binary. Then, run the following command to upload the binary to the Pico, replacing blink.elf with the name
of the ELF file you just built:
$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c
"program blink.elf verify reset exit"
If you are using a RP2350 based board, then use
$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000" -c
"program blink.elf verify reset exit"
Debug with SWD
You can also use openocd in server mode and connect a debugger that provides break points and more.
IMPORTANT
To allow debugging, build your binaries with the Debug build type using the DCMAKE_BUILD_TYPE option:
$ cd ~/pico/pico-examples/
$ rm -rf build
$ mkdir build
$ cd build
$ export PICO_SDK_PATH=../../pico-sdk
$ cmake -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico ..
$ cd blink
$ make -j4
Note: you should use -DPICO_BOARD=pico2 for a Raspberry Pi Pico 2.
The debug build provides more information when you run it under the debugger.
First, run an OpenOCD server:
$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
For a RP2350-based device use -f target/rp2350.cfg instead.
Then, open a second terminal window. Start your debugger, passing your binary as an argument:
Getting started with Raspberry Pi Pico-series
Debug with OpenOCD 23

Table of Contents

Related product manuals