Pico upload with RPi Debug Probe and cmsis_dap fails

I’m trying to upload some code to a RP2040 pico, using the current ArduinoMbed framework. The debug probe is the original Raspberry Pi Debug Probe.
Uploading via picotool works, but fails when the code is stuck in a hardfault, then a reset a bootsel is necessary. Now I want to use the debug probe and have changed my platformio.ini to:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino
upload_protocol = cmsis-dap
debug_speed = 5000

The cmsis-dap is found, but it fails with:

CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (1.9.0) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, raspberrypi-swd)
PACKAGES:
 - framework-arduino-mbed @ 4.0.2
 - tool-openocd-raspberrypi @ 2.1100.0 (11.0)
 - tool-rp2040tools @ 1.0.2
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
...
Configuring upload protocol...
AVAILABLE: cmsis-dap, jlink, picotool, raspberrypi-swd
CURRENT: upload_protocol = cmsis-dap
Uploading .pio\build\pico\firmware.elf
Open On-Chip Debugger 0.11.0+dev-gec0240e6a-dirty (2021-03-09-09:44)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 5000 kHz

target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
** Programming Started **
Warn : no flash bank found for address 0x10000000
Warn : no flash bank found for address 0x100167b8
** Programming Finished **
** Verify Started **
Warn : target was in unknown state when halt was requested
Error: timed out while waiting for target halted
Error: error executing cortex_m crc algorithm
Error: checksum mismatch - attempting binary compare
embedded:startup.tcl:530: Error: ** Verify Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 591
at file "embedded:startup.tcl", line 530
*** [upload] Error 1

is there some setting missing?

Maybe the official RP2040 platform is using an outdated OpenOCD, can you just change

to

platform = https://github.com/maxgerhardt/platform-raspberrypi.git

to use my fork (but will still use ArduinoCore-mbed)?

2 Likes

thanks,

using your platform files solves this problem, the upload via RPi debugger works fine.

1 Like

Morning Gents,

according to the docs at Raspberry Pi Documentation - Raspberry Pi Debug Probe, you need to be running OpenOCD version 0.11.0 or 0.12.0 to have support for the Debug Probe. If your already installed version is older, there are instructions on how to build it from source to get a working version.

HTH

Cheers,
Norm.