Chapter 1. Installing the GNU Tools

Table of Contents
1.1. GNU Binutils
1.2. AVR-GCC
1.3. AVR-LIBC
1.4. Programming Your Processor

This chapter shows how to build and install a complete development environment for the AVR processors using the GNU toolset.

I created an area for the AVR tools under /usr/local to keep this stuff separate from the base system. As root, I chown'ed /usr/local/avr under my normal account. This way, I don't have to be root to install the tools. All the instructions assume the tools will be installed in this location. If you want to place them in a different locations you need to specify the new location using the --prefix option.

Table 1-1. Tarball Locations

ToolVersionLocation
GNU Binutils2.11binutils-2.11.tar.bz2
AVR-GCC3.0.1gcc-core-3.0.1.tar.gz
AVR libc20020203avr-libc-20020203.tar.gz
AVR Programmer1.0buisp-1.0b.src.tar.gz

1.1. GNU Binutils

The binutils package provides all the low-level utilities needed in building and manipulating object files. Once installed, your environment will have an AVR assembler (avr-as), linker (avr-ld), and librarian (avr-ar and avr-ranlib). In addition, you get tools which extract data from object files (avr-objcopy), dissassemble object file information (avr-objdump), and strip information from object files (avr-strip). Before we can build the C compiler, these tools need to be in place.

The binutils source archive, used in preparing this document, is version 2.11. Its location is given in Table 1-1. Download the file and extract[1] its contents.

    % bunzip2 -c binutils-2.11.tar.bz2 | tar xf -
    % cd binutils-2.11

The next step is to configure and build the tools. This is done by supplying arguments to the configure script that enable the AVR-specific options.

    % configure --target=avr \
        --prefix=/usr/local/avr

When configure is run, it generates a lot of messages while it determines what is available on your operating system. When it finishes, it will have created several Makefiles that are custom tailored to your platform. At this point, you can build the project.[2]

    % make

If the tools compiled cleanly, you're ready to install them. If you specified a destination that isn't owned by your account, you'll need root access to install them. To install:

    % make install

Once this completes, you will have a set of utilities for the AVR processor. The executables are located in the bin directory located in the base directory you specified in the --prefix option. You'll have to add that directory to your search path in order to run them conveniently.

Notes

[1]

This file has been archived with bzip2, so bunzip2 needs to be already installed on your system.

[2]

BSD users should note that the project's Makefile uses GNU make syntax. This means FreeBSD users need to build the tools by using gmake.