Tuesday, July 20, 2010

Installation instructions of AVR development tools for Linux

This guide provides quick instructions how to install AVR development tools in various Linux distributions. For Windows platform, there is WinAVR containing all the same tools. Check out these instructions how to use AVR Studio with avr-gcc in Windows also. There are ports of AVR tools available for Mac OSX and FreeBSD as well.
In the excercise work lab, there are Linux systems with GNU AVR development tools available. With these instructions, students may install corresponding tools to their own computers. Students may also use their own laptop computers in the excercise lab if they wish so. Parallel port is required to upload code into the target AVR controller.
Students are encouraged to setup their own development environment. However, course personnel does not provide officially any support in installation or maintenance of private systems, except this document. If you can't make your system working with these instructions, please seek help from the internet society. There are plenty of documents and instructions just waiting for your googleing.

GNU toolchain

The GNU C-development toolchain consists of compiler, binary utilities and C-library. All the tools are available for Atmel's AVR target.
  • gcc-avr Gnu C Compiler for AVR
  • binutils-avr Binary utilities (linker, assembler, etc.) for AVR
  • avr-libc Basic C-library for AVR
  • gdb-avr Gnu debugger for AVR

Debian (apt)

Installation of GNU tools is very simple in a Debian based platform (Debian and Debian derivatives: Knoppix, Ubuntu, SELinux, etc.). The apt mechanism takes care of all the installation hasle without need to download installation packages manually. There exists ready made installation packages in standard sources servers for GNU development tools.In the command line, type the following commands with administrative privileges (root):
# apt-get install gcc-avr
# apt-get install avr-libc
# apt-get install gdb-avr
This will install, if not already installed, all the necessary development tools: gcc-avr, binutils-avr, avr-libc and gdb-avr. The same packages can be installed with graphical synaptic tool too.
In Ubuntu based systems (Ubuntu, Kubuntu, Edubuntu) you may need to enable universe packages. In the file /etc/apt/sources.list uncomment lines ending universe.

Redhat (yum/rpm)

In Red Hat based systems (Fedora Core and other derivatives; SuSe, Mandrake, etc.) with YUM package management system the installation of AVR tools is very similar to Debian installation. In the command line, give the following instructions with required priviledges (root):# yum install avr-gcc
# yum install avr-binutils
# yum install avr-libc
# yum install avr-gdb
There is also graphical gyum front-end available for the yum. If you have an older setup without YUM system, you must download rpm packages individually. There are several sources for the packages, good starting points are http://rpmfind.net and http://rpm.pbone.net. The set of required dependency packages depends on your system.
The minimum set of required packages is: avr-gcc, avr-binutils and avr-libc. Use the RPM tool to install packages:
# rpm \-ivh 

Other (src)

The most difficult way of installing the tools is to compile them from scratch. Use this method only if you can't get the tools using any package management tool. Compiling tools from sources provides option to have the tools in non-linux platforms. For more detailed information how to compile these tools for AVR target, check Rich Neswold's A GNU Development Environment for the AVR Microcontroller documentation. Note that the document is a bit old and version numbers do not apply anymore.
The standard 3-series gcc has support for AVR target. Gcc sources are available at gcc official web site http://gcc.gnu.org/. When configuring gcc build, use the following settings:
# configure \--target=avr \--enable-languages="c"*binutils*
The standard binutils package has support for AVR target. Official binutils web site is http://www.gnu.org/software/binutils/. When configuring binutils build, use the following setting:
# configure \--target=avr*libc\*
In embedded systems, language libraries must be as light weight as possible. There is no much resources available in the target hardware, thus general c libraries can not be used. For AVR there is a specific C library implementation available: http://www.nongnu.org/avr-libc/



UISP is a simple command line tool to upload compiled hex code into the target hardware. AVR supports in-system programming. New code can be programmed into the internal program flash memory via serial programming interface meanwhile the microcontroller is mounted in the embedded target hardware.
UISP supports many serial and parallel port programming cables. Most of Atmel's AVR versions are supported too. For more information, check the projects web site http://savannah.nongnu.org/projects/uisp/.


# apt-get install uisp


# yum install uisp


Download sources from UISP's web site, or elsewhere, and extract package. Compile and install program. Note that the last command (install) must be executed as root. If there is a newer version available, replace the version number in the package name with correct one.
# tar xvzf uisp-20050207.tar.gz
# uisp-20050207
# ./configure
# make
# make install
You may need to install parallel port drivers and set access permissions as root:
# modprobe ppdev
# chmod a+rw /dev/parport0


Avrdude is similar tool to the UISP. The tool was previously named avrprog. Avrdude supports wide range of programming tools and target AVR devices. It is know to run in Linux, FreeBSD, Mac OSX and Win32. Projects home page: http://savannah.nongnu.org/projects/avrdude.
Avrdude's configuration file allows user to define alternative programmer cable pin configurations. Thus it can be used with exotic programming cables as well.


The avrprog in debian sources is an oldversion. Not recommended! Compile the program from sources instead.
# apt-get install avrprog

Red Hat


Download sources from project page and extract it. Compile the code and install the program. Note that the last command (install) must be executed with super user priviledges (root). If there is a newer version available, replace the version number in the package name with correct one
# tar xvzf avrdude-5.0.tar.gz
# cd avrdude-5.0
# ./configure
# make
# make install
You may need to install parallel port drivers and set access permissions as root:
# modprobe ppdev
# chmod a+rw /dev/parport0


No comments:

Post a Comment