Wednesday, October 1, 2014

Setting Up the AVR Toolchain for Linux for AVR Development

Since I'm running an old version of Ubuntu (12.04), the AVR development tools in the repository are too old to handle the new ATxmega chips. So here's how to get up and running super quick with the AVR dev toolchain without reinstalling linux or compiling them yourself...
  1. Download the Atmel AVR Toolchain 3.4.x for Linux
  2. Extract it to either /usr/local/avr or ~/local/avr
    #!/bin/bash
    
    mkdir -p ~/local/avr
    cd ~/local/avr
    tar zxvf ~/Downloads/avr8-gnu-toolchain-*.tar.gz
    mv avr8-gnu-toolchain-* avr
    
  3. Add the path to your ~/.profile:
    # add avr toolchain to path (search ~/local/avr then /usr/local/avr)
    if [ -d "$HOME/local/avr/bin" ] ; then
        PATH="$HOME/local/avr/bin:$PATH"
    fi
    if [ -d "/usr/local/avr/bin" ] ; then
        PATH="/usr/local/avr/bin:$PATH"
    fi
    
    This will look for avr commands in your home first and then in /usr/local/avr, and only if they exist.
  4. Now logout, login and then check to see if its working:
    $ which avr-gcc
    This should output /home/$USER/local/avr/bin/avr-gcc, or wherever you put it.

No comments :