I have a similar issue: platformio debugging a pico with the debug probe does not work (Fedora 38). It hangs and runs into a timeout.
[env:picow-debugprobe]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
framework = arduino
board = pico
board_build.filesystem_size = 0.5m
board_build.core = earlephilhower
upload_protocol = cmsis-dap
debug_speed = 5000
debug_init_break = tbreak setup
debug_port = /dev/ttyACM0
debug_tool = cmsis-dap
When the PIO debug session is started I get the following output in the debug console:
(which is the same as for pio debug --interface=gdb – -x .pioinit)
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-09-11-23:12)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Hardware thread awareness created
Info : Hardware thread awareness created
adapter speed: 5000 kHz
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E661640843995133
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001
Info : [rp2040.core0] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core0] target has 4 breakpoints, 2 watchpoints
Info : [rp2040.core1] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core1] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
/home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb: /usr/lib64/libtinfo.so.5: no version information available (required by /home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb)
Reading symbols from /home/manuel/Documents/PlatformIO/Projects/PicoBlinky/.pio/build/picow-debugprobe/firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote target...
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
So here it hangs and there is a timeout after a while.
However, if I manually launch openocd and gdb it works:
"$ /home/manuel/.platformio/packages/tool-openocd-rp2040-earlephilhower/bin/openocd" -f "interface/cmsis-dap.cfg" -f "target/rp2040.cfg"
-c "adapter speed 5000" -c "program {.pio/build/picow-debugprobe/firmware.elf} verify
" -c "reset init" -c "resume"
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-09-11-23:12)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Hardware thread awareness created
Info : Hardware thread awareness created
adapter speed: 5000 kHz
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E661640843995133
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001
Info : [rp2040.core0] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core0] target has 4 breakpoints, 2 watchpoints
Info : [rp2040.core1] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core1] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
** Programming Started **
Info : Found flash device 'win w25q16jv' (ID 0x001540ef)
Info : RP2040 B0 Flash Probe: 2097152 bytes @0x10000000, in 32 sectors
Info : Padding image section 1 at 0x100173f0 with 16 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x10017400 .. 0x1001ffff
** Programming Finished **
** Verify Started **
** Verified OK **
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : New GDB Connection: 1, Target rp2040.core0, state: halted
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x10009692 msp: 0x20041ef8
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00
Also using a cortex-debug launch configuration works:
{
"name": "Pico Debug",
"cwd": "${workspaceRoot}",
"executable": "/home/manuel/Documents/PlatformIO/Projects/PicoBlinky/.pio/build/picow-debugprobe/firmware.elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"gdbPath": "/home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb",
"device": "RP2040",
"configFiles": [
"interface/cmsis-dap.cfg",
"target/rp2040.cfg"
],
"svdFile": "/home/manuel/.platformio/platforms/raspberrypi/misc/svd/rp2040.svd",
"runToEntryPoint": "setup",
"postRestartCommands": [
"break setup",
"continue"
]
}
Cortex-Debug: VSCode debugger extension version 1.12.1 git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from /home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-objdump --syms -C -h -w /home/manuel/Documents/PlatformIO/Projects/PicoBlinky/.pio/build/picow-debugprobe/firmware.elf
Reading symbols from /home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-nm --defined-only -S -l -C -p /home/manuel/Documents/PlatformIO/Projects/PicoBlinky/.pio/build/picow-debugprobe/firmware.elf
Launching GDB: /home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb -q --interpreter=mi2
IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems
Launching gdb-server: openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/manuel/Documents/PlatformIO/Projects/PicoBlinky -f /home/manuel/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rp2040.cfg
Please check TERMINAL tab (gdb-server) for output from openocd
Finished reading symbols from objdump: Time: 43 ms
/home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb: /usr/lib64/libtinfo.so.5: no version information available (required by /home/manuel/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb)
Output radix now set to decimal 10, hex a, octal 12.
Input radix now set to decimal 10, hex a, octal 12.
Finished reading symbols from nm: Time: 102 ms
warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread
setup () at src/main.cpp:83
83 void setup() {
Program stopped, probably due to a reset and/or halt issued by debugger
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
Note: automatically using hardware breakpoints for read-only addresses.
Thread 1 "rp2040.core0" hit Temporary breakpoint 2, setup () at src/main.cpp:83
83 void setup() {