I have two Rapsberry Pi Pico connected with SWD and one running picoprobe, following the instructions in the official Rapsberry Pi Docs: Getting started with Raspberry Pi Pico, Appendix A: Using Picoprobe
I have found these previous questions on the forum:
But after reading them it is still not clear how to use actual use PlatformIO to debug a program.
Do I need to edit platformio.ini so it knows about the picoprobe?
What values to I use?
How to I tell PlatformIO to debug and upload the firmware using via the picoprobe connection? Is this possible?
I personally use this to debug my Pico with my second Pico, and it works nicely, can debug both Cortex-M0+ cores even :).
Note If you already have written your program for ArduinoCore-mbed (default for framework = arduino and platform = raspberrypi), then you should not change the core to the Arduino-Pico one (done through board_build.core = earlephilhower), but just use the platformio.ini
Yeah, this does not quite work yet I just deleted my .platformio directory and re-installed everything, created a fresh project using your platformio.ini above. Build works! But upload failed with the error below.
I can see it download your repo. but ended up failing with a “dyld: Library not loaded:” error. I think this is a maybe a conflict with something in my file system?
Not too sure how to continue.
I would follow any instructions that work! So maybe will try your platform extension if you say it works.
rocessing pico (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing earlephilhower/tool-openocd-rp2040-earlephilhower @ ~5.100300.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: tool-openocd-rp2040-earlephilhower@5.100300.220714 has been installed!
Tool Manager: Installing earlephilhower/tool-mklittlefs-rp2040-earlephilhower @ ~5.100300.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: tool-mklittlefs-rp2040-earlephilhower@5.100300.220714 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (1.7.0+sha.5677d9b) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (picoprobe) External (cmsis-dap, jlink, picoprobe, raspberrypi-swd)
PACKAGES:
- framework-arduino-mbed @ 3.1.1
- tool-mklittlefs-rp2040-earlephilhower @ 5.100300.220714 (10.3.0)
- tool-openocd-rp2040-earlephilhower @ 5.100300.220714 (10.3.0)
- tool-rp2040tools @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio/build/pico/firmware.elf
Flash size: 2.00MB
Sketch size: 2.00MB
Filesystem size: 0.00MB
Maximium Sketch size: 2093056 EEPROM start: 0x101ff000 Filesystem start: 0x101ff000 Filesystem end: 0x101ff000
Checking size .pio/build/pico/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [== ] 15.1% (used 40696 bytes from 270336 bytes)
Flash: [ ] 0.2% (used 4034 bytes from 2093056 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, jlink, picoprobe, picotool, raspberrypi-swd
CURRENT: upload_protocol = picoprobe
Uploading .pio/build/pico/firmware.elf
dyld: Library not loaded: /usr/local/opt/hidapi/lib/libhidapi.0.dylib
Referenced from: /Users/daniel/.platformio/packages/tool-openocd-rp2040-earlephilhower/bin/openocd
Reason: image not found
*** [upload] Error -6
Your Mac M1 is special: There is currently indeed a bug in the packaged OpenOCD version for Mac, which is compiled for Mac x64. So for your ARM M1 1.) you need Rosetta installed 2.) You currently have to manually install the libhid dependency. This is tracked in M1 OpenOCD Upload Issues · Issue #703 · earlephilhower/arduino-pico · GitHub
Then I’m afraid our OpenOCD Mac packages are in general broken with regards to missing dependencies. The fix should be the same: Manually install libhid (and possibly others as they show up?) dependencies as linked.