Update:
Updated the platformio.ini file:
[env:uno]
platform = atmelavr
board = uno
framework = arduino
debug_tool = avr-stub
debug_port = COM5
; GDB stub implementation
lib_deps =
jdolinay/avr-debugger @ ~1.4
Now, while trying to debug the following error appears:
HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':
(.text+0x0): multiple definition of `__vector_18'
avr8-stub.c.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1
I believe I have added everything I do need in the sketch:
#include <Arduino.h>
#include "avr8-stub.h"
uint8_t button = 8;
uint8_t redLed = 10;
uint8_t buttonWasPressed;
void setup() {
debug_init();
pinMode(button, INPUT);
pinMode(redLed, OUTPUT);
Serial.begin(9600);
}
void loop() {
while(1) {
if(digitalRead(button) == LOW) {
if(buttonWasPressed == 0) {
digitalWrite(redLed, HIGH);
buttonWasPressed = 1;
}
}
else {
digitalWrite(redLed, LOW);
buttonWasPressed = 0;
}
}
}