PlatformIO Community

Atmega32 debugging with avarice and avr-gdb

Hello,

I would like to debug my simple blink C code for Atmega32 board with the following item on Linux.
AVR JTAG USB
Seems to be a clone of Atmel JTAG ICE (mkI) debugger.

I’m trying to use avarice with avr-gdb, but I have problems with setting up this debug environment correctly.

Is PlatformIO currently supporting this feature?

Thank you very much!

Best regards,
Mate

This is really great!
I could setup the environment.

My config:

[env:ATmega32]
platform = atmelavr
framework = arduino
board = ATmega32
debug_port = :4242
debug_load_cmds = 
debug_load_mode = manual
debug_tool = custom
debug_init_cmds =
  target remote $DEBUG_PORT
  file "$PROG_PATH"
  load /home/faeren/Projects/PlatformIO/testatmega32/.pio/build/ATmega32/firmware.elf
debug_server =
  avarice
  -1 
  -j/dev/ttyUSB0 
  --ignore-intr 
  :4242

I just have problems with adding breakpoints and stepping out of functions.

Adding breakpoint:
image

In case of stepping out the debug session just closes.

Do you have any idea why?

Thanks for your support!

Best regards,
Mate

1 Like

Interesting that AVARICE gets this far. Are you using the latest version from https://sourceforge.net/projects/avarice/?

When you go into “Output” is there any indication on why avarice has closed the connection? You might also get a better output if you replace the debug_server = with a dummy executable (like, true) and open avarice with the same command beforehand, then PIO will connect to it and you might get better debugging output from avarice.

I’m using the latest version from Arch linux repository which is
AVaRICE version 2.14svn20200906, Sep 9 2020 14:10:27

Visual Studio Code output is empty.

Avarice is just writing Segmentation fault (core dumped).
image

Yikes seems like a bug in the avarice code then. I guess you could dig down deeper by not starting avarice normally in a terminal but prefixed with gdb and again observe the crash and stack trace (if debug symbols are available in your avarice build). But mainly I think a bug should be filed at https://sourceforge.net/p/avarice/bugs/ with a reproducable project.

Thank you!

I just raised a ticket there.
Let’s see.