Debug doesn’t work at the moment.
The generated launch.json is not configured for the RaspberryPi Pico. It is setup for Arduino Uno.
snippet from launch.json
:
...
...
"executable": "user_path/PlatformIO/Projects/blink/.pio/build/uno/firmware.elf",
"projectEnvName": "uno",
"toolchainBinDir": "user_path/.platformio/packages/toolchain-atmelavr/bin",
...
...
where user_path
is the user home path for the blink
sketch.
I tried correcting the
and also tried using jlink
and stlink
for upload/debug.
Interestingly, PlatformIO has a new upload/debug option raspberrypi-swd
. I suspect this is for using a second Pico as a probe connected to the target Pico’s swd
pins.
Segger updated J-Link firmware on their J-Link probes (e.g. J-Link Edu Mini) a couple of months ago and I’ve used jlink
with the Pico under PlatformIO for debugging before. So, I was hoping that jlink
would work. I guess, there is some work to do in PlatformIO for Pico debugging.
With stlink
and the following settings under macOS 10.14.6
:
upload_port = /Volumes/RPI-RP2
debug_tool = stlink
debug_init_break = tbreak main
I get the following debug output:
Processing pico (platform: https://github.com/platformio/platform-raspberrypi.git; framework: arduino; board: pico)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (0.0.0+sha.aa251bf) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (stlink) External (cmsis-dap, raspberrypi-swd, stlink)
PACKAGES:
- framework-arduino-mbed 2.0.0
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio/build/pico/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [== ] 18.7% (used 50500 bytes from 270336 bytes)
Flash: [ ] 3.6% (used 75024 bytes from 2097152 bytes)
========================= [SUCCESS] Took 1.53 seconds =========================
Reading symbols from /Users/test/Documents/PlatformIO/Projects/test/.pio/build/pico/firmware.elf...
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
Open On-Chip Debugger 0.11.0+dev-gec0240e6a-dirty (2021-03-09-09:57)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
/Users/test/.platformio/packages/tool-openocd-raspberrypi/share/openocd/scripts/target/swj-dp.tcl:30: Error: Unknown param: -dp-id, try one of: -irlen, -irmask, -ircapture, -enable, -disable, -expected-id, or -ignore-version
in procedure 'script'
at file "embedded:startup.tcl", line 26
in procedure 'swj_newdap' called at file "/Users/quark1014/.platformio/packages/tool-openocd-raspberrypi/share/openocd/scripts/target/rp2040.cfg", line 8
at file "/Users/test/.platformio/packages/tool-openocd-raspberrypi/share/openocd/scripts/target/swj-dp.tcl", line 30
.pioinit:13: Error in sourced command file:
Remote connection closed
I’ll review the debug errors and check them against what I observe with debug using RaspberryPi SDK with Pico.