Hi,
i found this conversation of yours.
I tried it and i am able to upload the blinky example with stlink/v2 but it does not blink. if i upload using usb programming port it blinks.
#extra_script.py:
from os import path
Import(“env”)
platform = env.PioPlatform()
env.Prepend(
UPLOADERFLAGS=["-s", path.join(platform.get_package_dir("tool-openocd"), "scripts") or "",
"-f", "interface/stlink.cfg",
"-c", 'set CHIPNAME at91sam3X8E',
'-c', 'source [find target/at91sam3ax_8x.cfg]']
)
env.Append(
UPLOADERFLAGS=["-c", "telnet_port disabled; program {$SOURCE} 0x80000 verify reset; shutdown"]
)
env.Replace(
UPLOADER="openocd",
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
#platformio.ini
[env:due]
platform = atmelsam
board = due #dueUSB #due
framework = arduino
debug_tool = stlink
#upload_protocol = stlink
extra_scripts = extra_script.py
upload_protocol = custom
; Examples 2: temporary stop at void loop()
function
debug_init_break = tbreak loop
; Examples 3: stop in main.cpp at line 13
#debug_init_break = break main.cpp:13
build_unflags = -Os
build_flags = -Og -g3 -ggdb3
#debug_tool = custom
debug_server = /Users/phillip/.platformio/packages/tool-openocd/bin/openocd
-d3
-s
/Users/phillip/.platformio/packages/tool-openocd/scripts
-f
interface/stlink.cfg
-c "set CHIPNAME at91sam3X8E"
-c "source [find target/at91sam3ax_8x.cfg]"
the upload window:
Building .pio\build\due\firmware.bin
Configuring upload protocol…
AVAILABLE: atmel-ice, blackmagic, custom, jlink, sam-ba, stlink
CURRENT: upload_protocol = custom
Uploading .pio\build\due\firmware.bin
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-16-21:19)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
at91sam3X8E
Info : auto-selecting first available session transport “hla_swd”. To override use ‘transport select ’.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.222587
Info : at91sam3X8E.cpu: Cortex-M3 r2p0 processor detected
Info : at91sam3X8E.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for at91sam3X8E.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0010004c msp: 0x20001000
** Programming Started **
Info : sam3 auto-erases while programming (request ignored)
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
=========================================================== [SUCCESS] Took 12.04 seconds ===========================================================
I would be very greatful for your help.
Thanks and regards.