This document explains how to debug an AVR microcontroller connecting with the JTAG interface via USB using the GDB protocol, commonly used by Arduino.
On some systems it is necessary to install a driver and the SDK. You can find the links below:
Works for arduino and atmega128, ..
Install JTAG serial driver:
Install SDK from Arduino:
echo 'PATH="/Applications/Arduino.app//Contents/Java/hardware/tools/avr/bin/:$PATH"' >> ~/.profile
Install avarice, the gdbserver <-> jtag:
r2pm -i avarice
Run the proxy:
r2pm -r avarice --jtag /dev/tty.wch* --mkI :4242
Using GDB:
(avr-gdb) target remote :4242
In another terminal now run:
r2 -a avr -d gdb://localhost:4242
Right now the avr debugger is pretty broken, the memory and register reads result in in correct data.