Robostix avr gcc
From GumstixDocsWiki
This page contains information specific to the gcc version of the AVR toolchain. This could be under Windows or Linux. If you're using Windows, then the use of cygwin is assumed.
Contents |
Components
The GCC toolchain is comprised of 3 basic components:
| avr-libc | The runtime library |
| binutils | The linker, assembler, and tools for manipulating objects and libraries |
| avr-gcc | The C/C++ compiler |
Installing OS provided toolchains
Windows
Install WinAVR
Ubuntu
Under ubuntu (7.10 - Gutsy Gibbon) the following command will install the avr toolchain:
sudo apt-get install gcc-avr avr-libc gawk
You can also use the following to search for other packages which are related to the avr.
apt-cache search avr
Installing a pre-built Toolchain
The simplest way to get the toolchain and runtime library is to download a pre-built version of the toolchain. One for i386 linux is available here. Download the binary package tarball and expand it. For these instructions, the name of the downloaded file was avr_toolchain-core-2007-10-23.tar.bz2. Expanding the tarball
tar xjf avr_toolchain-core-2007-10-23.tar.bz2
will created a directory named avr. You can install the toolchain inside your home directory, or as root, you can install it in a global location. I chose to use my home directory.
To install it in the traditional "added programs" location, then as root:
mv avr /usr/local
In either case, the remainder of these instructions shall refer to the ~/avr or /usr/local/avr directory as the installation directory. I used ~/avr (which maps to /home/dhylands/avr as a fully qualified path).
Add the bin directory, located inside the installation directory to your PATH variable. This is normally done by editing your ~/.bashrc file and adding a line like this:
PATH=${PATH}:'/home/dhylands/avr/bin'
export PATH
You should now be able to type
avr-gcc --version
at the command line to get something like this output:
avr-gcc (GCC) 4.2.0 Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Installing avr-gcc from source
The official instructions for build avr-gcc from source can be found in the avr-libc document: Building and Installing the GNU Tool Chain.
Installing a newer avr-libc
The avr-libc that comes with the avr-toolchain-dist-2006-02-06.tar.bz2 tarball claims to be version 1.5.0.20051227. As of August 5, 2006, the latest version available from the avr libc download site is version 1.4.4, dated April 20, 2006).
Should you desire a newer version (than the one that comes with your compiler), you'll need to download it, expand it, configure it and build it. For the 1.4.0 tarball this would be something like this: (NOTE: The quote marks surrounding the ./config.guess is the back tick[`] found with the tilde[~] key)
tar xjf avr-libc-1.4.0.tar.bz2 cd avr-libc-1.4.0 ./configure --build=`./config.guess` --host=avr --prefix=/home/dhylands/avr make make install
By installing the new version of avr-libc over top of the old version, no additional compiler switches are required.

