Raspberry Pi RP2040 microcontroller - PIO support when? :)

I don’t tried it. Will it work with STLink?

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

  • executable path to user_path/PlatformIO/Projects/blink/.pio/build/pico/firmware.elf

  • toolchainBinDir path to the /.platformio/packages/toolchain-gccarmnoneeabi@1.80201.181220/bin

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.

Any plans to add the ‘baremetal’ framework (straight Pico C++ SDK)? I tried the WizIO version and it feels simpler and more straight forward than the Arduino + Mbed + Pico combination.

The Pico project was designed with software in mind and provides intuitive hardware and software combination that is very good as is and doesn’t need the Arduino ‘abstraction’ and overhead.

Hello @ ZPM1066, the PICO SWD port is compatible with the ST-Link? Are you sure?
Where can I find an example of use, that’s what interests me to test?
Thank you !

Hi @vidalv, unfortunately as far as I’m aware the Pico (RP2040) upload/debug isn’t currently available for ST-Link, see raspberrypi/openocd#13.

It appears that ST-Link V2 doesn’t support multidrop SWD, which is required for upload/debug. However, ST-Link V3 does support multidrop SWD, so we may get Pico support for it down the line. STMicroelectronics may themselves offer support or someone else may reverse engineer the ST-Link protocol and modify it for support.

Pico upload/debug works with J-Link, as Segger made a firmware update available back in March. I use several Segger Edu Mini probes. These are relatively inexpensive (~US$20), excellent and can be used with most microcontrollers.

Thank you for the information, it’s a shame that it is still buying a specific key to make the debug, under these conditions it is better to invest in another Pico that will serve as an interface for less than 5 €!

Unless, of course, you are also developing with nRF52840, STM , and microbit boards. These can all use J-Link and ST-Link. I tend to prefer J-Link for speed and flexibility.

Using another Pico as a picoprobe also works.

The second-pico-as-a-debugger (Picoprobe) works well with the WizIO’s setup of PIco/Platformio. It also provides the full Pico C++ SDK API, without the Arduino overhead and ‘dumbing down’.

just test

2 Likes