Hi,
I tried to debug an arduino due by the use of a st-link debugger. I think I connected the device corectly to the arduino and I update the ini. file in this way:
[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
upload_protocol = stlink
But the debugging does not work.
My debugger was a ST_LINK V2 and I tried it with an China clone too.
Do anybody have a step by step manual, how to do the debugger working? Or a detailed video?
Thanks for your help!
Michael
Debugging a Due with a ST-Link V2 (original version) is directly referenced in
We are pleased to announce the next release v3.4.0 of Atmel SAM development platform .
Demo: Debug Arduino Due via ST-Link
[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
[49]
Wiring Connections
[platformio-stlink-debug-arduino-due]
What’s New
New boards: Arduino MKR WiFi 1010, Adafruit Hallowing M0, Sodaq SARA, Sodaq SFF
Add support for debugging via J-Link
Add support for debugging (at91sam3X8E) via ST-Link (issue #31)
Update Adafruit Core to 1.2.3
U…
Please show the full current output of the “PIO Debug” task and your wiring between the due and the ST-Link V2.
mof182
October 8, 2024, 4:32pm
3
After a few months, I tried again to debug on an Arduino Due. I think I followed all instructions correctly, but I’m not able to do any debugging.
I allways get following messages when I tried to upload the code:
What I see is, that the led on the stlink adapter never flashs - it is always off - the driver for the adapter is installed.
Do anybody have any idea what could be my problem?
Best regards
Michael
mof182
October 8, 2024, 4:37pm
4
This is my platformio.ini file:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
upload_protocol = stlink
; change microcontroller
;board_build.mcu = at91sam3x8e
Yeah, I see the problem. When the OpenOCD upload is used, it uses the .bin file in the command without setting the start address of flash, so it assumes it’s 0x0000000. But in reality, the start offset is 0x80000 instead.
You have to help out PlatformIO a bit by using this platformio.ini
[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
upload_protocol = stlink
board_upload.offset_address = 0x80000
mof182
October 9, 2024, 5:36am
6
Yes, that was the issue and now it seems to work.
Thank You very much for your help!!!
best regards
Michael
I’ve tracked this issue in
opened 03:51PM - 09 Oct 24 UTC
When setting up an Arduino Due with `upload_protocol = stlink`, the upload by-de… fault **fails** because the upload is trying to use the `.bin` file without giving the correct start address of flash `0x80000`, so OpenOCD assumes `0x0` and fails to find flash memory there.
See community post:
https://community.platformio.org/t/step-by-step-description-for-st-link-debugging-with-arduino-due/41624/3?u=maxgerhardt
Failing `platformio.ini`
```ini
[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
upload_protocol = stlink
```
Upload failure

Fixed by manually adding (which shouldn't be needed)
```ini
board_upload.offset_address = 0x80000
```