PlatformIO Debbuging with Arduino Uno Blink Template

Hi Everyone !

I’m a newbie here and I would like to begin to work with an Arduino Uno Board.
But I meet some issues with the debug tools.

My setup :

  • VS Code :
    Version: 1.65.2 (user setup)
    Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
    Date: 2022-03-10T14:33:55.248Z
    Electron: 13.5.2
    Chromium: 91.0.4472.164
    Node.js: 14.16.0
    V8: 9.1.269.39-electron.0
    OS: Windows_NT x64 10.0.19043
  • Platform io version :
    Core 5.2.5 - Home 3.4.1
  • OS : Microsoft Windows [version 10.0.19043.1586]

I have used the project example arduino-blink to test.
I use only the “simulator mode” while debug (no board connected + PIO Debug Without Uploading)

  1. Using the default debug tool (avr-stub)
    Starting the debugging (F5)

1st pass

...
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
...

2nd pass

Reading symbols from c:\_TMP\PlatformIO\Projects\220328-011642-arduino-blink\.pio\build\uno\firmware.elf...
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = avr-stub
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:

3rd pass

Reading symbols from c:\_TMP\PlatformIO\Projects\220328-011642-arduino-blink\.pio\build\uno\firmware.elf...
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = avr-stub
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:
:3333: The system tried to join a drive to a directory on a joined drive.
  1. Using the debug tool (simavr)
    Precondition : There is 3 breakpoints in the Blink.cpp file (setup line 12, loop line 18 and 22)
    Starting the debugging (F5)

1st pass

1st pass
Reading symbols from c:\_TMP\PlatformIO\Projects\220328-011642-arduino-blink\.pio\build\uno\firmware.elf...
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = simavr
PlatformIO: Initializing remote target...
0x00000000 in __vectors ()
warning: Can not parse XML memory map; XML support was disabled at compile time
Temporary breakpoint 1 at 0x440: file C:\.platformio\packages\framework-arduino-avr\cores\arduino/main.cpp, line 35.
Loading section .text, size 0x45e lma 0x0
Start address 0x0, load size 1118
Transfer rate: 8944 bits in <1 sec, 186 bytes/write.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug

Temporary breakpoint 
1, main () at C:\.platformio\packages\framework-arduino-avr\cores\arduino/main.cpp:35
35		init();

Run (F5) next breakpoint Blink.cpp setup (line 12)

Run (F5) next breakpoint Blink.cpp loop (line 18)

Run (F5) next breakpoint Blink.cpp loop (line 22) after about 20 seconds

Run (F5) next breakpoint Blink.cpp loop (line 18) after about 20 seconds

Stop (Shift+F5)

Run (F5) next breakpoint Blink.cpp loop (line 18)

Restart (Ctrl+Shift+F5) next breakpoint Blink.cpp loop (line 18)

Run (F5) next breakpoint Blink.cpp loop (line 22)

Run (F5) next breakpoint Blink.cpp setup (line 12)

Run (F5) next breakpoint main.cpp file (line 35)

Run (F5) Always run…

2nd pass and more

Reading symbols from c:\_TMP\PlatformIO\Projects\220328-011642-arduino-blink\.pio\build\uno\firmware.elf...
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = simavr
PlatformIO: Initializing remote target...
0x00000000 in __vectors ()
warning: Can not parse XML memory map; XML support was disabled at compile time
Temporary breakpoint 1 at 0x440: file C:\.platformio\packages\framework-arduino-avr\cores\arduino/main.cpp, line 35.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug

Breakpoint 
3, loop () at src/Blink.cpp:18
18	  digitalWrite(LED_BUILTIN, HIGH);

Run (F5) next breakpoint Blink.cpp loop (line 22)

Run (F5) next breakpoint Blink.cpp setup (line 12)

Run (F5) next breakpoint main.cpp file (line 35)

Run (F5) Always run…

Then
If I change again the debug tool (go to 1) Using the default debug tool (avr-stub)), I will meet the same error message sequence.

Please file an issue in Issues · platformio/platform-atmelavr · GitHub.