-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request to Add J-Link and ST-Link Upload & Debug Support to RP2040 Pico #5
Comments
Raspberry Pi Picoprobe seems to be using the |
Hi @zpm1066 ! J-Link should be available in the dev branch. Would be great if you could try the following configuration for both uploading and debugging: [env:pico]
platform = raspberrypi
framework = arduino
board = pico
upload_protocol = jlink
debug_tool = jlink As for ST-Link, it seems that it's not compatible with RP2040, at least now raspberrypi/openocd#13 |
Hi @valeros, PlatformIO sees
Previously, I've successfully used the above Would it be possible to provide a version of PlatformIO that recognizes Regarding the error I'm available for further testing as required. Thank you. Method #1I used the following
I got the following output, with error
Method #2Used debug tool
|
My bad, sorry, you need this config: [env:pico]
platform = https://github.com/platformio/platform-raspberrypi.git
framework = arduino
board = pico
upload_protocol = jlink
debug_tool = jlink |
With the following config, I still get
|
Hmm, is there any chance you have two instances of the |
Here's the requested output.
|
As I thought, you have the dev platform installed from this repository, but it's outdated. Please run |
OK. I've updated the platform. Here's the output:
|
Debugging doesn't work as well, right? |
Good news! Debug seems to work. Thank you. |
I'm able to single step through the blink sketch (RGB version of blink) on my
|
Is it possible to use the Segger tools instead of the openocd? Something like this: |
I'll look into your suggestion. I did try flashing the
If the SEGGER added write to |
.bin has no start address, and default 0 is incorrect, try 0x10000000. |
Thanks @vorosj. Code upload to Pico using
Can we modify PlatformIO to generate & use .hex file for J-Link uploads, like with other platforms (e.g. nRF52840)? If not, How do I force PlatformIO upload to use address of |
Hi zpm1066, I studied the Segger docs, and it seems the JflashLite is not suitable for the job. JFlash is capable, but not working with the edu tools. I think JLink.exe can do it as well, but I didn't tried yet. It needs some scripting.
A Python script for the job: https://www.programmersought.com/article/38735814995/ |
Hi @vorosj, Thanks. I wonder whether PlatformIO can adapt what is being used by platform/platform-nordicnrf52 for .hex files? The PlatformIO developers may know more. |
Hi @valeros, @ivankravets, We're so close to getting both uploads & debug to work for Pico with J-Link. Can we get PlatformIO modified to use .hex files for RP2040 J-link uploads? Thanks. |
Hi guys, thanks for the research. I've switched J-Link to use hex files, please pull the latest changes from the dev branch and try again. |
Hi valeros, upload_protocol = jlink Upload is working. :-) Debug failed.
|
@vorosj Do you mind sharing the entire log from the debug console? |
If I use Ozone with the.elf, the following happens:
|
Do you mind sharing the entire log from the debug console? It's on the console after star the debug session, it stopped at init();
|
Performing single step... |
As it doesn't stop after the single step, I pushed pause: Program |
The Led is not blinking if I push continue. |
This is the test source: #include <Arduino.h> void setup() { void loop() { |
Hi @ valeros, @vorosj, Thank you very much. I've updated the I can single step through the code but the debug behavior is not always consistent. The debugger doesn't hit a breakpoint in my blink's loop() until a hit restart from within the PIO debugger after the first time I enter the debugger. Subsequent step into & out and stopovers are fine. So it seems there may be a minor quirk with the debugging but I'll do some more debugging shortly and report back. The upload of the .hex file works consistently. I have tested it on several of my Mac systems - macOS 11.3.1 (MacBook Pro 13"), macOS 14.6 MacBook Air Early 2014 mid-2014) and macOS 10.12.6 (Mac mini mid-2011). @ valeros, @ vorosj, Try the following:
The above works for me consistently in debugging my RGB blink program. |
Thank you very much, it's working. :-) |
Breakpoints and single step is working with the above workaround. |
Hi @vorosj, Wonderful! I'm not quite sure why a RESET is required but we now have a one-stop solution for Pico development with PlatformIO. I have multiple Pico boards - official Raspberry Pi Pico board, Pimoroni Tiny2040, and Adafruit RP2040. That latter has the LiPo battery support and option to add a standard J-link connector but I haven't used it much yet. The Pimoroni Tiny2040 is a great little Pico board with SWD and 8GB Flash. Works fine with ILI9341, ST7789 and SSD1306 displays. It's my preferred Pico board at the moment. |
Thanks @vorosj. I'll review and reproduce your debug findings. I hope to do some more Pico debugging later today. |
Usually I am working with bare metal, but Arduino is great because of the sensor, lcd, Wifi etc libraries. Using an ILI9341 LCD is really comfortable in Arduino. I like Arduino because of PlatformIO, before that I tried the Arduino IDE and concluded that it's unuseful for anything bigger than Led blinking... :-) |
Cool! I do bare metal as well but since last year, I've moved to Zephyr-RTOS. A large set of sensor drivers, BT, display drivers for ILI9241-ST7789-SSD1306, LVGL graphics, libraries for it but not as much as Arduino. Also, it is quite easy to write your own device drivers. A very active Github for Zehyr updates.Lots of good online documentation and for us nRF5240 Nordic Semiconductor fans, Nordic has adopted Zephyr-RTOS. Being an old school real-time software engineer/consultant, I typically use a mixture of MCUs - nRF52840 (Nordic Dongles - superb inexpensive BT dev boards, Particle Xenon with SWD/LiPo, BBC microbit v2 - builtin cmsis-dap or jlink); STM32 (blackpill stm32f411ce); ESP32/ESP8266 for MQTT deployments ; and some Arduinos plus Nano nRF24L01. However, the Raspberry Pi Pico has been of interest lately because of its current & future potential, and price point. I do occasionally use the Segger IDE for nRF5240 but find PlatformIO+Zephyr combo works very well. I have heard great things about Keil and IAR IDEs but they are not available for macOS. Arduino Core-Mbed is Arduino Core running on top of Mbed OS. This is a C++ based RTOS adopted by ARM consortium but differs quite a bit from Zephyr. The devicetree hierarchical data structure (Linux based) that Zephyr uses to map hardware takes getting used to but is excellent. I can easily use mostly of the same code & libraries unchanged across the different MCUs with only the device overlays being different for each MCU, depending on what GPIOs I'm using. I strongly recommended PlatformIO with Zephyr-RTOS. |
Morning all... :) Just this past week I acquired a Pi Pico board and a EDU mini, I installed support for them in PlatformIO and update the firmware for the EDU mini. I first uploaded the blink LED code via 'picotool binary' method repeatedly with no problem, then tried via J-Link then the problem occurred. The first upload of blink hex is successful, on the second upload of the exact same hex file the EDU mini reports 'ERROR: Could not connect to target'. I did the same with 'J-Flash Lite V7.20' program with exact same LED hex file compiled by platformio to directly upload to the Pi Pico board bypassing platformio completely… This is my link to my original platformio community post, I can re-post necessary bits of it as required... |
Power down the Raspberry Pi Pico and then flash it. I can't recall if a power down was needed before for J-Link but it seems now that with PlatformIO or I tried to replicate your test with |
Hi @valeros, It seems now that in order to flash a Raspberry Pi Pico with J-Link, a power cycle of the Pico is required. I don't think that was the case earlier back in May. Are you seeing the same? If you can, please confirm. We should be able to flash the Pico without a power cycle or a reset of the board. Thank you. |
The above issue has been fixed by Segger with J-Link firmware v7.5 update. Please update PlatformIO with J-Link v7.5 files. Thanks. |
For the STlink you could use Raspberry version EBlink https://github.com/EmBitz/EBlink/tree/master/packages |
Currently, PlatformIO only seems to support
cmsis-dap and raspberry-swd
debug options.jlink
andstlink
do not appear to be supported.SEGGER
have updated their J-Link probe firmware to support Pico uploads (flash to QSPI) and debugging, see https://www.segger.com/products/debug-probes/j-link/ forRelease Notes
.I've been able to debug a Pico using a combination of
VSCODE + cmake + Picoprobe
and thePlatformIO Debugger
. In addition, a Picoelf
can be debugged using aSEGGER Educ Mini probe & Ozone Debugger
combination.I'm not sure what changes are required in PlatformIO Debugger to work but the Raspberry Pico probe needed
OpenOCD
to be built with the Picoprobe driver, as detailed in the Raspberry Pi documentation at https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf.It would be highly productive if we can have an out-of-the-box
jlink
(andstlink
) support forRP2040 Pico
upload & debug.I'm available to assist with any testing required to support this feature request.
Your efforts to provide a complete PlatformIO support for the RP2040 are much appreciated by all of us in the
PlatformIO
andRaspberry Pi
communities. Thanks you.The text was updated successfully, but these errors were encountered: