Debugging AVR ICs using JTAGICE and Eclipse in Linux

The method is tested in Ubuntu 14.04 and LinuxMint 17 with Eclipse Indigo version.


Test debugging in terminal by typing the following commands

sudo avarice --erase --program --file LED.elf --jtag /dev/ttyUSB0 :4242

Above command will start the GDB Server on Port 4242. User need to change the filename(LED.elf) to match their binary, and may need to change the port number of JTAG(/dev/ttyUSB0)

Take another Terminal and type the following

sudo avr-gdb LED.elf
target remote localhost:4242

Above command make connections to the GDB server. Make sure the connection is established successfully in the GDB Server terminal.

User need to install AVR Toolchain in Linux and AVR Plugin in Eclipse.


Create a project and add a main.c file as below.

 * main.c
 *  Created on: 25-Oct-2014
 *      Author: dhanish

#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
//#include <avr/iom16m1.h>

int main(void) {
    DDRB |= 1<<PB0; /* set PB0 to output */
    while(1) {
        PORTB &= ~(1<<PB0); /* LED on */
        asm volatile("nop");
        PORTB |= 1<<PB0; /* LED off */
        asm volatile("nop");

    return 0;

In Project properties select Dwarf-2 as debugging option under C Compiler settings.


Eclipse configuration —

In External Tools configuration under Run create a tool named avarice and put options as shown below

–ignore-intr –erase –program –file LED.elf –jtag /dev/ttyUSB0 :4242


If the GDB Hardware Debugging configuration type is not shown you do not have this optional feature installed, install it using Help –> Install New Software Then browse this update site and install the Eclipse C/C++ GDB Hardware Debugging optional feature.

Then use the following configuration as shown below.

debug_eclipse2 debug_eclipse3



Elementz Ebay Store

AVR_plugin installation in Eclipse

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s