PlatformIO Community

Why no debugging support for AT90CAN128 and Atmel-ICE?


I am using PlatformIO for the AT90CAN128 and would like to use its Debugging capability.
Unfortunately the debugging for the controller ist not supported by PlatformIO, also other AVR MCU are supported.

Can someone tell me what might the main problem is? Would it be possible to implement it by myself with a few steps or would it be possible to pay someone to in order to implement this Feature?

Every time someone tried it using opensource software like AVARICE, (project page) they always into some bugs. Maybe that software has improved now. I’ve tried using a fork in the past because the latest avarice version on sourceforge had compile errors (AVaRICE / Bugs / #31 Cannot compile avarice-2.14.tar.bz2 due to '__unused').

You should check out CLion / Avarice debug not working and Atmega32 debugging with avarice and avr-gdb - #2 by mate910327. The general gist is that you have to get a program to connect to the chip (via the Atmel-ICE JTAG adapter in your case) and start a GDB server. The VSCode debugger can then connect to that (see debug_options).

The very first thing you should do is grab the latest official avarice version (from the SVN, not the release pages, svn checkout avarice-code) and compile it, and you should do that under Linux (e.g. standard Ubuntu either native or in VirtualBox virtual machine with the Atmel-ICE USB device passed through) since native Windows (or MinGW) is not supported, only via Cygwin / MSYS2 emulation. Goes like

# to get USB support
sudo apt install libusb-dev
# download source & compile it
cd avarice-code-r392-trunk-avarice
chmod +x Bootstrap
sudo make install
# should work
avarice --help

Once you have that working you can try connecting to your chip

avarice --jtag /dev/ttyS10 -P at90can128 -d  :4242

(/dev/ttyS10 is the serial port for the Atmel-ICE device), or

avarice --edbg -P at90can128 -d  :4242


  -1, --mkI                   Connect to JTAG ICE mkI (default)
  -2, --mkII                  Connect to JTAG ICE mkII
  -3, --jtag3                 Connect to JTAGICE3 (Firmware 2.x)
  -4, --edbg                  Atmel-ICE, or JTAGICE3 (firmware 3.x), or EDBG Integrated Debugger
  -j, --jtag <devname>        Port attached to JTAG box (default: /dev/avrjtag).

And so you can see whether avarice can connect to your chip at all, or if that fails.

EDIT: I’ve just seen that this latest SVN version is also included in Ubuntu LTS 22.04 (see Ubuntu Manpage: avarice - Provides an interface from avr-gdb to Atmel's AVR in-circuit debugging tools and 2.14+svn392-1 : avarice : amd64 : Jammy (22.04) : Ubuntu), so if you use that, you won’t have to compile it yourself as you can just sudo apt install avarice.