It’s technically not a sucker punch if you yell “Defend yourself, cocksucker!” two seconds before you let him have it. — Modern Drunkard Magazine

RSS Feed

Building AVR-GCC

http://www.pololu.com/docs/0J31/2

Generally, the avr-gcc that is included with most distros is either outdated or broken. Let’s build a current set of tools.

Compiling binutils

  1. Download the source code.

    Grab the latest binutils from here.

  2. Unpack the archive.
    tar xzf ~/Desktop/binutils-2.19.1.tar.gz
    cd binutils-2.19.1
  3. Configuring and compiling binutils
    The options give here just specify that the AVR version of binutils should be compiled:


    ./configure --prefix=/usr/local --target=avr
    make
    sudo make install

Compiling avr-gcc

  1. Install prerequisites

    Recent versions of GCC depend on GMP and MPFR, which can be installed from their web pages. Under Ubuntu, you can get these packages by running the following command.


    sudo apt-get install libgmp3-dev libmpfr-dev

  2. Downloading the source code

    Get the latest version of gcc from the GCC FTP site. Make sure and get the whole thing and not just gcc-core.

  3. Unpack the archive


    tar xjf ~/Desktop/gcc-4.4.0.tar.bz2
    cd gcc-4.4.0

  4. Configure, compile, and install GCC

    Note that you need to compile GCC from a separate directory, and that we are specifying that only C and C++ be included.


    mkdir obj
    cd obj
    ../configure --prefix=/usr/local --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp
    make
    sudo make install

Compiling avr-libc

  1. Downloading the source code

    Get the latest version from the avr-libc website. You should get version 1.6.6 or higher.

  2. Unpack the archive


    tar xjf ~/Desktop/avr-libc-1.6.6.tar.bz2
    cd avr-libc-1.6.6

  3. Configuring and compiling avr-libc


    ./configure --host=avr --prefix=/usr/local
    make
    sudo make install

Compiling AVRDUDE

  1. Downloading the source code

    Get the latest version from the AVRDUDE web site.

  2. Unpack the archive


    tar xzf ~/Desktop/avrdude-5.6.tar.gz
    cd avrdude-5.6

  3. Compiling and installing AVRDUDE


    ./configure
    make
    sudo make install

Finished

That’s it, you’re done.