August 12, 2022

Raspberry Pi Pico - GDB, OpenOCD and the Pico Probe, part 2

To play this game I do the following. In one terminal windows I launch openocd as follows:
openocd -f interface/cmsis-dap.cfg -c "adapter speed 5000" -f target/rp2040.cfg
Then in another terminal window I launch gdb:
arm-none-eabi-gdb -q -ex "target extended-remote :3333" blink.elf
It is certainly possible to omit the "blink.elf" and just start a gdb session.

Some gdb commands

Control-C -- interrupt the running code
i r -- shows the registers
stepi -- execute one assembly instruction
nexti -- as above, but a function call is executed until it returns
disas 0x50, 0x60 - disassemble from start to end
x/nfu 0x40 - examines memory
    n = how many
    f = format (usually x for hex), maybe x, i, s
    u = how big b, h, w, g are 1,2,4,8 byte objects
continue -- run to breakpoint (or forever)
load xyz.elf -- load the program
load xyz.elf offset -- load at offset
run -- start from beginning

Some openocd commands

reset halt -- to get control


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org