Help with PIO Debugger using Atmel ICE and Arduino Due

Hm. Let’s first patch the corrected upload method via an extra script to make that more robust, maybe the pio debug command can then also upload the (right) firmware?

Add to the platformio.ini

extra_scripts = extra_script.py
upload_protocol = custom

Add a extra_script.py on the same level as the platformio.ini with:

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/cmsis-dap.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"
)

Does then the normal upload button work?

I’ve upgraded your trust level so this should be solved.

1 Like