welcome: please sign in
location: avrlinux

AVR and Ubuntu Linux

Setting up an environment to work with AVR MCUs under Linux is not hard! This tutorial shows how to set-up the Eclipse IDE to work with the avr-gcc tool chain, avrdude and AVaRice (debugging). Most of it is based on the Ask Mr. Roboto columns, by Dennis Clark, on April and May 2010 Servo Magazines.

Let's begin!


Eduardo Ristow

AVR tool chain:

First install the AVR Tool Chain, composed by avr-gcc compiler, avr c library, avrdude and AVaRice.

sudo apt-get install gcc-avr avr-libc avrdude avarice

Check if avr-gcc is installed correctly:

avr-gcc -v

The output should be something like this:

Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --disable-libssp --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=avr Thread model: single gcc version 4.3.4 (GCC)

The same for avrdude:

avrdude -v

should output:

avrdude: Version 5.10, compiled on Mar 23 2010 at 15:05:31

Optional: Arduino support

If you have an Arduino or intend to play with it later on:

sudo apt-get install librxtx-java

Eclipse IDE

Now you will need Eclipse, it is a really versatile Integrated Development Environment (IDE) that works with various languages, even though its main target is Java. Since the repository Eclipse comes with full Java support, which is not needed in this case, there are two routes.

Repository version (with Java)

If you use Java and/or prefer the repository version:

sudo apt-get install eclipse eclipse-cdt

Open the Eclipse IDE, then go to Help > Install New Software.

Click on the 'Add...' button and add the folllwing:

Name: AVR Eclipse Plugin

Location:  http://avr-eclipse.sourceforge.net/updatesite/

Click on the 'Available Software Sites' link and enable the CDT software site, then click ok.

Choose '--All Available Sites--' and install the following for full C/C++ and AVR support, including debbuging:

Mobile and Device Development > Eclipse C/C++ DSF gdb Debugger Integration

Mobile and Device Development > Eclipse C/C++ Memory Enhancements

Mobile and Device Development > Eclipse C/C++ Remote Launch

Programing Languages >  Eclipse C/C++ Development Tools

CDT Optional Features > AVR Eclipse Plugin

CDT Optional Features > AVR Eclipse Plugin Sources

CDT Optional Features > CDT Debugger Services Framework (DSF Examples)

CDT Optional Features > CDT GCC Cross Compiler Support

CDT Optional Features > CDT GNU Toolchain Build Support

CDT Optional Features > CDT GNU Toolchain Debug Support

CDT Optional Features > CDT Utilities

CDT Optional Features > Eclipse C/C++ Development Plataform

CDT Optional Features > Eclipse C/C++ DSF gdb Debbuger Integration

CDT Optional Features > Eclipse C/C++GDB Hardware Debugging

CDT Optional Features > Eclipse C/C++Memory View Enhancements

CDT Optional Features > Eclipse C/C++ Remote Launch

CDT Optional Features > Eclipse CDT p2 Toolchain Installer

CDT Optional Features > Eclipse CDT Testing Feature

Eclipse CDT (without Java)

For those that don't code Java and only need C/C++, I highly recommend to install the Eclipse CDT. Just download the latest version of Eclipse IDE for C/C++ Developers from Eclipse.org and save it to a known location (in this example I will use ~/Downloads).

I prefer to keep the optional programs installed by my self on the /opt, but fell free to place it elsewhere.

sudo mv ~/Downloads/eclipse-cpp-helios-SR1-linux-gtk-x86_64.tar.gz /opt
cd /opt
sudo tar xfv eclipse-cpp-helios-SR1-linux-gtk-x86_64.tar.gz

Now Eclipse CDT is installed, but since it was directly installed, there won't be a menu icon. To correct that, just create a link on the menu pointing to "/opt/eclipse/eclipse".

In order for Eclipse to know where to find the compiler, deciding what options to use and build the makefiles, you need a plugin.

Until version 3.5 (Galieo) it was needed to point Eclipse towards the plugin website. However now there is the Eclipse Marketplace, which made things even easier!

Open Eclipse and navigate to Help > Eclipse Marketplace. There select the Yoxos Marketplace - by EclipseSource, it will download the index of available plugins. Now just search for AVR. Among the results select AVR Eclipse Plugin, it will warn you about Unsigned content, just click OK, no need to worry! Just wait for it to be downloaded and installed; when prompted to restart Eclipse, do so.

Almost There

Now everything is set, just start a project:

Start codding!


Still To Do

avrlinux (last edited 2011-03-15 16:09:28 by EduardoRistow)