Debug an avr 4809 with microUPDI?

Yea this totally “just works” on Windows too for me without any modifications and all the recent versions.

Can you try and reproduce my setup with the platformio.ini above? With the procedure to first upload normally and then start debugging.

Testing source code is

#include <Arduino.h>

int i = 0;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(100);
  digitalWrite(LED_BUILTIN, LOW);
  delay(100);
  i++;
  Serial.println("iteration " + String(i));
}

Also the displayed packages during building are

Processing ATmega4809 (platform: atmelmegaavr; board: nano_every; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/nano_every.html
PLATFORM: Atmel megaAVR (1.4.0) > Arduino Nano Every
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 47.50KB Flash  
PACKAGES:
 - framework-arduino-megaavr 1.8.7
 - toolchain-atmelavr 1.70300.191015 (7.3.0)        
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf

so if there’s a mismatch that might be the culprit.

o.k., I’ll revert my change to the pretty printing line and give the above a go. Thanks for all the experimentation.

this looks good, I think it’s working with a break point in line 10. If I use your PIO.ini as is (with nano every specified), and load the code into my (non every) 4809 I get this from debug console:

The python script continues to run ntil I terminate the debug session in VSCode :


C:\Users\Paul\Downloads\pyAVRdbg-master\pyAVRdbg-master>python main.py
INFO:pyedbglib.hidtransport.hidtransportbase:Manufacturer: ATMEL
INFO:pyedbglib.hidtransport.hidtransportbase:Product: mEDBG CMSIS-DAP
INFO:pyedbglib.hidtransport.hidtransportbase:Serial Number: MICROUPDIPROGRAMMERX
INFO:pymcuprog.deviceinfo.deviceinfo:Looking for device atmega4809
INFO:pymcuprog.nvm:UPDI baud rate: 900000bps
INFO:root:Event recived
PC: 1006
INFO:root:Recived break event
INFO:root:No event
Waiting for GDB session 127.0.0.1:12555
Connected by ('127.0.0.1', 64246)
-> +
INFO:root:No event
-> $qSupported:multiprocess+;qRelocInsn+#2a
<- +
INFO:root:AVR running state False
Supported:multiprocess+;qRelocInsn+
<- $PacketSize=1000#f1
INFO:root:No event
-> +$!#21
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$Hg0#df
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$qTStatus#49
<- +
INFO:root:AVR running state False
TStatus
<- $#00
INFO:root:No event
-> +$?#3f
<- +
INFO:root:AVR running state False
<- $S00#b3
INFO:root:No event
-> +$qfThreadInfo#bb
<- +
INFO:root:AVR running state False
fThreadInfo
<- $#00
INFO:root:No event
-> +$qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +$Hc-1#09
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$qC#b4
<- +
INFO:root:AVR running state False
C
<- $#00
INFO:root:No event
-> +$qAttached#8f
<- +
INFO:root:AVR running state False
Attached
<- $0#30
INFO:root:No event
-> +$qOffsets#4b
<- +
INFO:root:AVR running state False
Offsets
<- $Text=000;Data=000;Bss=000#24
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x64', '0x0', '0x0', '0x0', '0xc', '0xd1', '0x53', '0x2', '0x0', '0x0', '0xe2', '0x94', '0x4', '0x0', '0xe8', '0x8b', '0xb5', '0x2', '0x0', '0x4', '0xed', '0x3f', '0xb0', '0xa']
['0x35']
['0xe0', '0x3f']
<- $0000000000000000640000000cd153020000e2940400e88bb5020004ed3fb00a35e03f#13
INFO:root:No event
-> +$p22#d4
<- +
INFO:root:AVR running state False
817
0x331
0x662
00000662
62060000
<- $62060000#8e
INFO:root:No event
-> +$m654,e#9d
<- +
INFO:root:AVR running state False
654
e
0
INFO:root:Reading from address 0x000654
bytearray(b'\xcf\x93\x8f\xb7\xf8\x94 \x91\xad(0\x91\xae(')
cf938fb7f8942091ad283091ae28
<- $cf938fb7f8942091ad283091ae28#6f
INFO:root:No event
-> +$qSymbol::#5b
<- +
INFO:root:AVR running state False
Symbol::
<- $OK#9a
INFO:root:No event
-> +$mbf2,2#c5
<- +
INFO:root:AVR running state False
bf2
2
0
INFO:root:Reading from address 0x000BF2
bytearray(b'a\xe0')
61e0
<- $61e0#fc
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $mbf2,2#c5
<- +
INFO:root:AVR running state False
bf2
2
0
INFO:root:Reading from address 0x000BF2
bytearray(b'a\xe0')
61e0
<- $61e0#fc
INFO:root:No event
-> +$m803fe2,2#63
<- +
INFO:root:AVR running state False
803fe2
2
80
INFO:root:Reading from address 0x003FE2
bytearray(b'\x03}')
037d
<- $037d#fe
INFO:root:No event
-> +$m6ae,40#f9
<- +
INFO:root:AVR running state False
6ae
40
0
INFO:root:Reading from address 0x0006AE
bytearray(b'\x8f\x92\x9f\x92\xaf\x92\xbf\x92\xcf\x92\xdf\x92\xef\x92\xff\x92K\x01\\\x01\x0e\x94*\x03k\x01|\x01\xa8\xee\xb3\xe0\xa5\x01\x94\x01\x0e\x94e\x07\xc6\x0e\xd7\x1e\xe8\x1e\xf9\x1e\xc6\x16\xd7\x06\xe8\x06\xf9\x068\xf4\x0e\x94*\x03\xc6\x16')
8f929f92af92bf92cf92df92ef92ff924b015c010e942a036b017c01a8eeb3e0a50194010e946507c60ed71ee81ef91ec616d706e806f90638f40e942a03c616
<- $8f929f92af92bf92cf92df92ef92ff924b015c010e942a036b017c01a8eeb3e0a50194010e946507c60ed71ee81ef91ec616d706e806f90638f40e942a03c616#1d
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x0f')
060f
<- $060f#fc
INFO:root:No event
-> +$m803fe2,2#63
<- +
INFO:root:AVR running state False
803fe2
2
80
INFO:root:Reading from address 0x003FE2
bytearray(b'\x03}')
037d
<- $037d#fe
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x0f')
060f
<- $060f#fc
INFO:root:No event
-> +$mbe4,3a#28
<- +
INFO:root:AVR running state False
be4
3a
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbfa\xe0p\xe0\x8d\xe0\x0e\x94\xc8\x01d\xe6p\xe0\x80\xe0\x90\xe0\x0e\x94W\x03p\xe0`\xe0\x8d\xe0\x0e\x94\xc8\x01d\xe6p\xe0\x80\xe0\x90\xe0\x0e\x94W\x03')
cf93df93cdb7deb72c97cdbfdebf61e070e08de00e94c80164e670e080e090e00e94570370e060e08de00e94c80164e670e080e090e00e945703
<- $cf93df93cdb7deb72c97cdbfdebf61e070e08de00e94c80164e670e080e090e00e94570370e060e08de00e94c80164e670e080e090e00e945703#39
INFO:root:No event
-> +$m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x0f')
060f
<- $060f#fc
INFO:root:No event
-> +$m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +$qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $Z0,bf2,2#0e
<- +
INFO:root:AVR running state False
0
bf2
3058
<- $OK#9a
INFO:root:No event
-> +$vCont?#49
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$c#63
<- +
INFO:root:AVR running state False
INFO:root:No event
INFO:root:Event recived
PC: 1529
INFO:root:Recived break event
(64, 1529, 1)
<- $S05#b8
-> +$p22#d4
<- +
INFO:root:AVR running state False
1529
0x5f9
0xbf2
00000bf2
f20b0000
<- $f20b0000#ea
INFO:root:No event
-> +$mbe4,e#f9
<- +
INFO:root:AVR running state False
be4
e
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbf')
cf93df93cdb7deb72c97cdbfdebf
<- $cf93df93cdb7deb72c97cdbfdebf#52
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0xa', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c32800000a5400000000ed3fbd2880ed3f#90
INFO:root:No event
-> +$z0,bf2,2#2e
<- +
INFO:root:AVR running state False
<- $OK#9a
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$s#73
<- +
INFO:root:AVR running state False
<- $S05#b8
INFO:root:Event recived
PC: 1530
INFO:root:Recived break event
(64, 1530, 1)
<- $S05#b8
-> +$p22#d4
<- +
INFO:root:AVR running state False
1530
0x5fa
0xbf4
00000bf4
f40b0000
<- $f40b0000#ec
INFO:root:No event
-> ++$mbe4,10#f5
<- +
INFO:root:AVR running state False
be4
10
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbfa\xe0')
cf93df93cdb7deb72c97cdbfdebf61e0
<- $cf93df93cdb7deb72c97cdbfdebf61e0#4e
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0x1', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c3280000015400000000ed3fbd2880ed3f#60
INFO:root:No event
-> +$Z0,bf2,2#0e
<- +
INFO:root:AVR running state False
0
bf2
3058
<- $OK#9a
INFO:root:No event
-> +$Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$c#63
<- +
INFO:root:AVR running state False
INFO:root:No event
INFO:root:Event recived
PC: 1529
INFO:root:Recived break event
(64, 1529, 1)
<- $S05#b8
-> +
INFO:root:No event
-> $p22#d4
<- +
INFO:root:AVR running state False
1529
0x5f9
0xbf2
00000bf2
f20b0000
<- $f20b0000#ea
INFO:root:No event
-> +$mbe4,e#f9
<- +
INFO:root:AVR running state False
be4
e
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbf')
cf93df93cdb7deb72c97cdbfdebf
<- $cf93df93cdb7deb72c97cdbfdebf#52
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0xa', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c32800000a5400000000ed3fbd2880ed3f#90
INFO:root:No event
-> +$z0,bf2,2#2e
<- +
INFO:root:AVR running state False
<- $OK#9a
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$s#73
<- +
INFO:root:AVR running state False
<- $S05#b8
INFO:root:Event recived
PC: 1530
INFO:root:Recived break event
(64, 1530, 1)
<- $S05#b8
-> +$p22#d4
<- +
INFO:root:AVR running state False
1530
0x5fa
0xbf4
00000bf4
f40b0000
<- $f40b0000#ec
INFO:root:No event
-> ++$mbe4,10#f5
<- +
INFO:root:AVR running state False
be4
10
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbfa\xe0')
cf93df93cdb7deb72c97cdbfdebf61e0
<- $cf93df93cdb7deb72c97cdbfdebf61e0#4e
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0x1', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c3280000015400000000ed3fbd2880ed3f#60
INFO:root:No event
-> +$Z0,bf2,2#0e
<- +
INFO:root:AVR running state False
0
bf2
3058
<- $OK#9a
INFO:root:No event
-> +$Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$c#63
<- +
INFO:root:AVR running state False
INFO:root:No event
INFO:root:Event recived
PC: 1529
INFO:root:Recived break event
(64, 1529, 1)
<- $S05#b8
-> +
INFO:root:No event
-> $p22#d4
<- +
INFO:root:AVR running state False
1529
0x5f9
0xbf2
00000bf2
f20b0000
<- $f20b0000#ea
INFO:root:No event
-> +$mbe4,e#f9
<- +
INFO:root:AVR running state False
be4
e
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbf')
cf93df93cdb7deb72c97cdbfdebf
<- $cf93df93cdb7deb72c97cdbfdebf#52
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0xa', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c32800000a5400000000ed3fbd2880ed3f#90
INFO:root:No event
-> +$z0,bf2,2#2e
<- +
INFO:root:AVR running state False
<- $OK#9a
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$s#73
<- +
INFO:root:AVR running state False
<- $S05#b8
INFO:root:Event recived
PC: 1530
INFO:root:Recived break event
(64, 1530, 1)
<- $S05#b8
-> +$p22#d4
<- +
INFO:root:AVR running state False
1530
0x5fa
0xbf4
00000bf4
f40b0000
<- $f40b0000#ec
INFO:root:No event
-> ++$mbe4,10#f5
<- +
INFO:root:AVR running state False
be4
10
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbfa\xe0')
cf93df93cdb7deb72c97cdbfdebf61e0
<- $cf93df93cdb7deb72c97cdbfdebf61e0#4e
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0x1', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c3280000015400000000ed3fbd2880ed3f#60
INFO:root:No event
-> +$Z0,bf2,2#0e
<- +
INFO:root:AVR running state False
0
bf2
3058
<- $OK#9a
INFO:root:No event
-> +$Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$c#63
<- +
INFO:root:AVR running state False
INFO:root:No event
INFO:root:Event recived
PC: 1529
INFO:root:Recived break event
(64, 1529, 1)
<- $S05#b8
-> +
INFO:root:No event
-> $p22#d4
<- +
INFO:root:AVR running state False
1529
0x5f9
0xbf2
00000bf2
f20b0000
<- $f20b0000#ea
INFO:root:No event
-> +$mbe4,e#f9
<- +
INFO:root:AVR running state False
be4
e
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbf')
cf93df93cdb7deb72c97cdbfdebf
<- $cf93df93cdb7deb72c97cdbfdebf#52
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc3', '0x28', '0x0', '0x0', '0xa', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c32800000a5400000000ed3fbd2880ed3f#90
INFO:root:No event
-> +$z0,bf2,2#2e
<- +
INFO:root:AVR running state False
<- $OK#9a
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $qRcmd,7265736574#37
<- +
INFO:root:AVR running state False
Rcmd,7265736574
<- $#00
INFO:root:No event
-> +$vKill;a410#33
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$k#6b
<- +
INFO:root:AVR running state False

C:\Users\Paul\Downloads\pyAVRdbg-master\pyAVRdbg-master>

So that’s really good. I have a nano every board as it happens. I’ll see if I can take things any further with watching some vars / expressions.

We (but mainly you :slight_smile: ) have come a long way with this. Will the nano every be where it ends? That could work for debugging couldn’t it? The 4809 dip doesn’t have some of the i/o pins, but these could be disabled in the source code before upload to the every? Just thinking out loud.

Hmmm it’s still disconnecting there with your configuration at not finding pio_reset_run_target. This is weird because it’s not doing that for me.

Did you 100% copy my platformio.ini? Can you open a CLI and do pio upgrade --dev and pio platform update atmelmegaavr, then restart VSCode and retry?

yes a straight copy - ctrl+a, ctrl+c etc I’ll action the above tomorrow a.m. and post back.

sorry - stuck at the basics again - how to open a cli in PIO?

edit - ok needs to use platformio upgrade --dev

it has upgraded to 5.1.1b1

So having done the two upgrade/ updates which were succesful, closing and restarting vscode, cycling the power on the 4809, reloading the code and trying a debug start followed 20 seconds or so later by a debug stop), I get this form the debug console:

and this is the output from the python script


C:\Users\Paul\Downloads\pyAVRdbg-master\pyAVRdbg-master>python main.py
INFO:pyedbglib.hidtransport.hidtransportbase:Manufacturer: ATMEL
INFO:pyedbglib.hidtransport.hidtransportbase:Product: mEDBG CMSIS-DAP
INFO:pyedbglib.hidtransport.hidtransportbase:Serial Number: MICROUPDIPROGRAMMERX
INFO:pymcuprog.deviceinfo.deviceinfo:Looking for device atmega4809
INFO:pymcuprog.nvm:UPDI baud rate: 900000bps
INFO:root:Event recived
PC: 1900
INFO:root:Recived break event
INFO:root:No event
Waiting for GDB session 127.0.0.1:12555
Connected by ('127.0.0.1', 50394)
-> +$qSupported:multiprocess+;qRelocInsn+#2a
<- +
INFO:root:AVR running state False
Supported:multiprocess+;qRelocInsn+
<- $PacketSize=1000#f1
INFO:root:No event
-> +$!#21
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$Hg0#df
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$qTStatus#49
<- +
INFO:root:AVR running state False
TStatus
<- $#00
INFO:root:No event
-> +$?#3f
<- +
INFO:root:AVR running state False
<- $S00#b3
INFO:root:No event
-> +$qfThreadInfo#bb
<- +
INFO:root:AVR running state False
fThreadInfo
<- $#00
INFO:root:No event
-> +$qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +$Hc-1#09
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$qC#b4
<- +
INFO:root:AVR running state False
C
<- $#00
INFO:root:No event
-> +$qAttached#8f
<- +
INFO:root:AVR running state False
Attached
<- $0#30
INFO:root:No event
-> +$qOffsets#4b
<- +
INFO:root:AVR running state False
Offsets
<- $Text=000;Data=000;Bss=000#24
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x64', '0x0', '0x0', '0x0', '0x1c', '0xd7', '0x26', '0x1', '0x0', '0x0', '0x83', '0x49', '0x0', '0x0', '0x0', '0xc', '0x26', '0x1', '0x0', '0x4', '0xb4', '0x3f', '0xb0', '0xa']
['0x82']
['0xde', '0x3f']
<- $0000000000000000640000001cd72601000083490000000c26010004b43fb00a82de3f#78
INFO:root:No event
-> +$p22#d4
<- +
INFO:root:AVR running state False
1900
0x76c
0xed8
00000ed8
d80e0000
<- $d80e0000#f1
INFO:root:No event
-> +$meca,e#27
<- +
INFO:root:AVR running state False
eca
e
0
INFO:root:Reading from address 0x000ECA
bytearray(b'\x0e\x94\xa1\x07\xa5\x9f\x90\r\xb4\x9f\x90\r\xa4\x9f')
0e94a107a59f900db49f900da49f
<- $0e94a107a59f900db49f900da49f#93
INFO:root:No event
-> +$qSymbol::#5b
<- +
INFO:root:AVR running state False
Symbol::
<- $OK#9a
INFO:root:No event
-> +$mbf2,2#c5
<- +
INFO:root:AVR running state False
bf2
2
0
INFO:root:Reading from address 0x000BF2
bytearray(b'a\xe0')
61e0
<- $61e0#fc
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $mbf2,2#c5
<- +
INFO:root:AVR running state False
bf2
2
0
INFO:root:Reading from address 0x000BF2
bytearray(b'a\xe0')
61e0
<- $61e0#fc
INFO:root:No event
-> +$qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +$m803fdf,2#96
<- +
INFO:root:AVR running state False
803fdf
2
80
INFO:root:Reading from address 0x003FDF
bytearray(b'\x03H')
0348
<- $0348#cf
INFO:root:No event
-> +$m654,3c#ce
<- +
INFO:root:AVR running state False
654
3c
0
INFO:root:Reading from address 0x000654
bytearray(b'\xcf\x93\x8f\xb7\xf8\x94 \x91\xad(0\x91\xae(@\x91\xaf(P\x91\xb0(\xe0\xeb\xfa\xe0\xc2\x85\x96\x81\x90\xff\x06\xc0/_?OOO_O\xc0\x91\xba\n\x8f\xbf\xa0\x91\xb7(\xb0\x91\xb8(\x0e\x94e\x07')
cf938fb7f8942091ad283091ae284091af285091b028e0ebfae0c285968190ff06c02f5f3f4f4f4f5f4fc091ba0a8fbfa091b728b091b8280e946507
<- $cf938fb7f8942091ad283091ae284091af285091b028e0ebfae0c285968190ff06c02f5f3f4f4f4f5f4fc091ba0a8fbfa091b728b091b8280e946507#51
INFO:root:No event
-> +$m803fe2,2#63
<- +
INFO:root:AVR running state False
803fe2
2
80
INFO:root:Reading from address 0x003FE2
bytearray(b'\x03}')
037d
<- $037d#fe
INFO:root:No event
-> +$m803fdf,2#96
<- +
INFO:root:AVR running state False
803fdf
2
80
INFO:root:Reading from address 0x003FDF
bytearray(b'\x03H')
0348
<- $0348#cf
INFO:root:No event
-> +$m803fe2,2#63
<- +
INFO:root:AVR running state False
803fe2
2
80
INFO:root:Reading from address 0x003FE2
bytearray(b'\x03}')
037d
<- $037d#fe
INFO:root:No event
-> +$m6ae,40#f9
<- +
INFO:root:AVR running state False
6ae
40
0
INFO:root:Reading from address 0x0006AE
bytearray(b'\x8f\x92\x9f\x92\xaf\x92\xbf\x92\xcf\x92\xdf\x92\xef\x92\xff\x92K\x01\\\x01\x0e\x94*\x03k\x01|\x01\xa8\xee\xb3\xe0\xa5\x01\x94\x01\x0e\x94e\x07\xc6\x0e\xd7\x1e\xe8\x1e\xf9\x1e\xc6\x16\xd7\x06\xe8\x06\xf9\x068\xf4\x0e\x94*\x03\xc6\x16')
8f929f92af92bf92cf92df92ef92ff924b015c010e942a036b017c01a8eeb3e0a50194010e946507c60ed71ee81ef91ec616d706e806f90638f40e942a03c616
<- $8f929f92af92bf92cf92df92ef92ff924b015c010e942a036b017c01a8eeb3e0a50194010e946507c60ed71ee81ef91ec616d706e806f90638f40e942a03c616#1d
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x04')
0604
<- $0604#ca
INFO:root:No event
-> +$m803fe2,2#63
<- +
INFO:root:AVR running state False
803fe2
2
80
INFO:root:Reading from address 0x003FE2
bytearray(b'\x03}')
037d
<- $037d#fe
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x04')
0604
<- $0604#ca
INFO:root:No event
-> +$mbe4,24#fa
<- +
INFO:root:AVR running state False
be4
24
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbfa\xe0p\xe0\x8d\xe0\x0e\x94\xc8\x01d\xe6p\xe0\x80\xe0\x90\xe0\x0e\x94W\x03')
cf93df93cdb7deb72c97cdbfdebf61e070e08de00e94c80164e670e080e090e00e945703
<- $cf93df93cdb7deb72c97cdbfdebf61e070e08de00e94c80164e670e080e090e00e945703#46
INFO:root:No event
-> +$m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$m803fec,2#94
<- +
INFO:root:AVR running state False
803fec
2
80
INFO:root:Reading from address 0x003FEC
bytearray(b'\x06\x04')
0604
<- $0604#ca
INFO:root:No event
-> +$m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +$qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $Z0,bf2,2#0e
<- +
INFO:root:AVR running state False
0
bf2
3058
<- $OK#9a
INFO:root:No event
-> +$vCont?#49
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$Hc0#db
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$c#63
<- +
INFO:root:AVR running state False
INFO:root:No event
INFO:root:Event recived
PC: 1529
INFO:root:Recived break event
(64, 1529, 1)
<- $S05#b8
-> +
INFO:root:No event
-> $p22#d4
<- +
INFO:root:AVR running state False
1529
0x5f9
0xbf2
00000bf2
f20b0000
<- $f20b0000#ea
INFO:root:No event
-> +$mbe4,e#f9
<- +
INFO:root:AVR running state False
be4
e
0
INFO:root:Reading from address 0x000BE4
bytearray(b'\xcf\x93\xdf\x93\xcd\xb7\xde\xb7,\x97\xcd\xbf\xde\xbf')
cf93df93cdb7deb72c97cdbfdebf
<- $cf93df93cdb7deb72c97cdbfdebf#52
INFO:root:No event
-> +$g#67
<- +
INFO:root:AVR running state False
['0x9a', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xc2', '0x28', '0x0', '0x0', '0xa', '0x54', '0x0', '0x0', '0x0', '0x0', '0xed', '0x3f', '0xbd', '0x28']
['0x80']
['0xed', '0x3f']
<- $9a0000000000000000000000000000000000c22800000a5400000000ed3fbd2880ed3f#8f
INFO:root:No event
-> +$z0,bf2,2#2e
<- +
INFO:root:AVR running state False
<- $OK#9a
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $qL1200000000000000000#50
<- +
INFO:root:AVR running state False
L1200000000000000000
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m803ffc,2#95
<- +
INFO:root:AVR running state False
803ffc
2
80
INFO:root:Reading from address 0x003FFC
bytearray(b'\x06\xa8')
06a8
<- $06a8#ff
INFO:root:No event
-> +$md44,c#c8
<- +
INFO:root:AVR running state False
d44
c
0
INFO:root:Reading from address 0x000D44
bytearray(b'\x0e\x943\x04\x0e\x94\xf7\x03\x0e\x94\xf2\x05')
0e9433040e94f7030e94f205
<- $0e9433040e94f7030e94f205#cd
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $qRcmd,7265736574#37
<- +
INFO:root:AVR running state False
Rcmd,7265736574
<- $#00
INFO:root:No event
-> +$vKill;a410#33
<- +
INFO:root:AVR running state False
<- $#00
INFO:root:No event
-> +$k#6b
<- +
INFO:root:AVR running state False

C:\Users\Paul\Downloads\pyAVRdbg-master\pyAVRdbg-master>

btw what is the significance of

pio_reset_run_target ?

PlatformIO expects there to be the GDB function definition that will reset the chip and then let it run the firmware from the start. Examples.

This is really weird though that you’re getting it. Can you show a screenshot of the full platformio.ini you’re using?

here’s a screenshot of it:

Mhmm, absolutely identical.

And your VSCode PlatformIO extension is also on 2.3.0?

Have you made double sure to select the right active project with the project environment switcher? Does restarting VSCode help?

does this mean it’s selected?

I only have the one soure file loaded - blink led

not sure how to check pio extension version - will have a look

edit:

I guess this is evidence that the right active project?:

> Executing task: C:\Users\Paul\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing ATmega4809 (platform: atmelmegaavr; board: nano_every; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/nano_every.html
PLATFORM: Atmel megaAVR (1.4.0) > Arduino Nano Every
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 47.50KB Flash
PACKAGES:
 - framework-arduino-megaavr 1.8.7
 - tool-avrdude-megaavr 1.60300.191015 (6.3.0)
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio\build\ATmega4809\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.1% (used 189 bytes from 6144 bytes)
Flash: [=         ]  10.7% (used 5186 bytes from 48640 bytes)
Configuring upload protocol...
AVAILABLE: custom
CURRENT: upload_protocol = custom
Uploading .pio\build\ATmega4809\firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.10s

avrdude: Device signature = 0x1e9651 (probably m4809)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file ".pio\build\ATmega4809\firmware.hex"
avrdude: writing flash (5186 bytes):

Writing | ################################################## | 100% 1.68s

avrdude: 5186 bytes of flash written
avrdude: verifying flash memory against .pio\build\ATmega4809\firmware.hex:
avrdude: load data flash data from input file .pio\build\ATmega4809\firmware.hex:
avrdude: input file .pio\build\ATmega4809\firmware.hex contains 5186 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.35s

avrdude: verifying ...
avrdude: 5186 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)

avrdude done.  Thank you.

Extension version can be checked in the extension sidebars in VSCode

The current project and environment is at the bottom with “env:ATmega4809 (atmega4809)” in env:<environment name> (project name) format.

Also make sure that for debugging you have the right project selected in the dropdown.

grafik

just checked in sidebar and ver for Platformio IDE is 2.3.0

also, just to say that pio_reset_run_target message only appears when I select ‘stop debugging’ from the vsc menu

also 2, my debug drop down looks like this, which doesn’t show the 4809 env:

edit:

I guess this json stuff shows the 4809 environment in “platformio-debug”


{
    "version": "0.2.0",
    "configurations": [
        

    
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug",
            "executable": "c:/Users/Paul/Documents/PlatformIO/Projects/debug-4809/.pio/build/ATmega4809/firmware.elf",
            "projectEnvName": "ATmega4809",
            "toolchainBinDir": "C:/Users/Paul/.platformio/packages/toolchain-atmelavr@1.70300.191015/bin",
            "internalConsoleOptions": "openOnSessionStart",
            "preLaunchTask": {
                "type": "PlatformIO",
                "task": "Pre-Debug"
            }
        },
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug (skip Pre-Debug)",
            "executable": "c:/Users/Paul/Documents/PlatformIO/Projects/debug-4809/.pio/build/ATmega4809/firmware.elf",
            "projectEnvName": "ATmega4809",
            "toolchainBinDir": "C:/Users/Paul/.platformio/packages/toolchain-atmelavr@1.70300.191015/bin",
            "internalConsoleOptions": "openOnSessionStart"
        }
    ]
}


I think this is working isn’t it? I start debugging and then F5 to continue - it seems to cycle around to the BP again at each F5, then I select stop debugging:

Ah it actually stops at a breakpoint for you? And then you can single-step and hover over variables or functions and see their details?

I thought you would get disconnected from the debugger as soon as you hit “start debugging”.

yes I can start, then it stops at break in line 10. I can use F10 to single step, but there are some error windows popping up in the bottom right of the IDE. Also, if I watch the variable i (int i =0;) i get an odd initial value as shown below. As I press F10, i increments but sometimes not by 1

and yes I can hover over vars such as i in the following line and see a value

Serial.println("iteration " + String(i));

but it’s an unexpected value e.g 1466 - I would obviously expect 1, 2, 3, etc as the loop cycles.

That’s related to the fact that we didn’t write an instruction in the debug_init_cmds to reset the chip. It’s like “attaching” to the chip while it has already been running for a while – hence the large iteration number. I was able to press the reset button and then it still hit my following breakpoints, with a clean program start. pyAVRdbg currently doesn’t have the capability to reset the chip (Debug the avr 4809 chip · Issue #9 · stemnic/pyAVRdbg · GitHub), so it also can’t be included in PlatformIO right now.

But with that, everything’s great! :slight_smile:

Ah brill, I thought on reflection it looked like the debug attaching after prog execution started.

Brilliant that it’s now working, reset is easy enough. I might review my PIO.ini with you as there are things in there I’m not sure about.

Also, just to note that the serial print (i) didn’t print to the serial monitor, but I guess that’s because the port’s in use by the debug system.

I’m guessing that i/o over a uart will need to avoid the debug port? Just thinking of my code which sends and receives text over serial.

Can I automate the python script start up from pio or does that need to be a manual start - no worries it’s just a small thing in the scale of things.

Is there anything to do in order to share this with folks?

Many thanks,
Paul

Sorry to open this again, but something odd has happened and after a break of two months from the project, I am getting this error again:

Sometimes debug faills with a different error and I haven’t captured that one yet.

I reviewed this thread, and I haven’t undone any of the changes made, so my expectation would be that it should work, a bit perplexing…

pio.ini below and the project is just a simple blinkled, also below


[env:ATmega4809]
platform = atmelmegaavr
board = ATmega4809
board_build.variant = 40pin-standard  

framework = arduino
upload_protocol = custom
upload_flags =
    -C
    $PROJECT_PACKAGES_DIR/tool-avrdude-megaavr/avrdude.conf
    -p
    $BOARD_MCU
    -c
    xplainedmini_updi
    -Pusb
    -b115200
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
debug_tool = custom
; no debug server
debug_server =
debug_port = 127.0.0.1:12555
build_type = debug
debug_load_mode = manual
debug_init_cmds =
  target extended-remote $DEBUG_PORT
  $INIT_BREAK
debug_init_break = tbreak loop

source:

#include <Arduino.h>

int i = 0;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(100);
  digitalWrite(LED_BUILTIN, LOW);
  delay(100);
  i++;
  if (i>1000)
  {i=0;}
  Serial.println("iteration " + String(i));
}

my process is:
open a cmd prompt and run the python script
from VScode pick ‘start debugging’
debug fails and this output is displayed in the debug console window:

No symbol "target" in current context.
WARNING: Error executing command 'gdb-set target-async on'
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
0x00000808 in micros ()
    at C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX/wiring.c:125
125	  return m * 1000 + (t >> 4);
Current language:  auto; currently c++
Breakpoint 1 at 0xbc4: file src/main.cpp, line 9.
PlatformIO: Initialization completed

many thanks for any thoughts on anything to try.
Paul