RP2040 debugging slow and not really working?

Hi,

I need some help with debugging an RP2040 via Picoprobe from within PlatformIO.

Up until now I have been using the USB Port of the Pi Pico to upload my programm. This was my configuration in PlatformIO that has been working well.

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico
framework = arduino
lib_extra_dirs = /Users/Succubus/Documents/Arduino/libraries
build_flags = 
    -DTARGET_RP2040 
    -O2
upload_protocol = picotool
upload_port = D:

Since the program has become lager I wanted to have the possibilty to debug my code and hence ordered a Picoprobe.

I have changed the configration to

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico
framework = arduino
lib_extra_dirs = /Users/Succubus/Documents/Arduino/libraries
build_flags = 
    -DTARGET_RP2040 
    -O2
upload_protocol = cmsis-dap
upload_port = cmsis-dap
debug_tool = cmsis-dap

and this seems to work. The code is uploaded the the PI but very slowly. The normal upload via USB takes about 10 seconds. The SWD methode over 70. I got a lot of messages that looks like this during the upload

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00

but ultimately

Programming Finished 
 Verify Started 
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00
 Verified OK 
 Resetting Target 
shutdown command invoked

so besides being slow this works. Now the real problem is debuggin. I set a breakpoint at the start of my main programm. And start debuggin with ctrl+shift+D.

after about 2 minutes I get a lot of output from the terminal windows again

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (31168 ms). Workaround: increase "set remotetimeout" in GDB
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00

and the code stops at a temporary breakpoint somewhere deep in the workings of PlatformIO. Fine let it continue, but now my set breakpoint is never reched. I also got an error message in a pop up that says:

Unable to parse SVD file: TypeError: Cannot read properties of undefined (reading '0')

and

A syntax error in expression, near `'. (from data-evaluate-expression struct)

So basically I have 2 problems the slow speed and the fact that I can not debug at All. I am using Windows 10 with the latest Visual Studio Code release. Everything seems to be up to date. Any idea how to solve this?

.

BR Christopher

Set debug_speed higher as needed. What is the size of the firmware.bin?

The SVD parser in the PlatformIO extension is unable to parse the RP2040 SVD file. I already reported this, but I cannot provide any fix for it myself.

The firmware is 1.7 MByte accoring to the file explorer. Upload speed is configured to 1000 kHz.

Okay, it seems to be running somehow. But during debuggin nothing will be listed under Peripherials. It says loading but nothing happens. Is this normal?

Peripherals won’t be shown in the debug view unless PlatformIO fixes their bug on their side. There’s nothing I can do for that. Another extension like Cortex-Debug might work, with a custom configuration of course. The SVD file you should reference is in ~/.platformio/platforms/raspberrypi/misc/svd/rp2040.svd.

Flashing is really slow indeed. Even at 10MHz SWD speed. I remember this to be a bit faster… but then again, we are just using RaspberryPi’s OpenOCD version (GitHub - raspberrypi/openocd) to do this, and no special config files. 1.5 MB takes a whopping 3m18s for me to flash.

I’ve opened

because of that.