Unable to attach debugger to Arduino Due

That did help to connect to the target, and I can step through the code and set breakpoints. Thanks!!

The next issue I’m facing is variables are not updating. Setting their value in the IDE doesn’t give any error, but doesn’t seem to be set on the target.

My program has a variable that is used to set the delay in a blink led example. When I try to set the variable value from the IDE, or from the debug console there’s no errors given, and the value seems to update in the debugger, but not on the target. It feels like the variable value is cached and updated locally, but not pushed to the target. Is there a command I need to use to force the variable value to be loaded to the target?

Here’s my program:

#include <Arduino.h>

void setup() {
    // put your setup code here, to run once:
    pinMode(LED_BUILTIN, OUTPUT);
}

int i = 0;

void loop() {
    // put your main code here, to run repeatedly:
    digitalWrite(LED_BUILTIN, HIGH);
    delay(i);
    digitalWrite(LED_BUILTIN, LOW);
    delay(i);
    if ((i++ % 10) == 0) {
        i += 50;
    }
}

Here’s my platformio.ini file:

[env:blink]
platform = atmelsam
board = dueUSB
framework = arduino
upload_port = /dev/cu.usbmodem31
monitor_port = /dev/cu.usbmodem31
debug_tool = blackmagic
debug_port = /dev/cu.usbmodem7AB57B81
debug_load_cmd =
debug_load_mode = manual
debug_init_cmds =
  target extended-remote $DEBUG_PORT
  monitor swdp_scan
  attach 1
  break main.cpp:setup

I don’t know if my problem is that I’m not issuing the load command to GDB. If I do then I get the vFlashErase error.