Getting started with Raspberry Pi Pico
$ openocd -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
Your output should look like this:
...
Info : rp2040.core0: hardware has 4 breakpoints, 2 watchpoints
Info : rp2040.core1: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
WARNING
If you see an error like
has signal integrity issues. Try different GPIO jumper cables.
This OpenOCD terminal needs to be left open. So go ahead and open another terminal, in this one we'll attach a gdb
instance to OpenOCD. Navigate to the "Hello World" example code, and start
$ cd ~/pico/pico-examples/build/hello_world/serial
$ gdb-multiarch hello_serial.elf
Connect GDB to OpenOCD,
(gdb) target remote localhost:3333
TIP
You can create a
"target remote localhost:3333" > ~/.gdbinit
and load
hello_serial.elf
(gdb) load
Loading section .boot2, size 0x100 lma 0x10000000
Loading section .text, size 0x22d0 lma 0x10000100
Loading section .rodata, size 0x4a0 lma 0x100023d0
Loading section .ARM.exidx, size 0x8 lma 0x10002870
Loading section .data, size 0xb94 lma 0x10002878
Start address 0x10000104, load size 13324
Transfer rate: 31 KB/sec, 2664 bytes/write.
and then start it running.
(gdb) monitor reset init
(gdb) continue
6.3. Use GDB and OpenOCD to debug Hello World
then your Raspberry Pi Pico is either powered off, wired incorrectly, or
Info : DAP init failed
file so you don't have to type
.gdbinit
. However, this interferes with debugging in VSCode
into flash,
from the command line.
gdb
target remote localhost:3333
every time. Do this with
echo
(Chapter
7).
23
Need help?
Do you have a question about the RP2040 and is the answer not in the manual?