Skip to content

Instantly share code, notes, and snippets.

@geekscape
Created April 10, 2014 01:53
Show Gist options
  • Save geekscape/10336517 to your computer and use it in GitHub Desktop.
Save geekscape/10336517 to your computer and use it in GitHub Desktop.
Raspberry Pi /History: Build avr-gcc tool chain for ATMega256RFR2
Raspberry Pi
Sun Mar 16 19:44:44 EST 2014 [andyg]
Build avr-gcc tool chain for ATMega256RFR2
- See http://www.nongnu.org/avr-libc/user-manual/install_tools.html
- See http://permalink.gmane.org/gmane.comp.gcc.patches/283638
- See https://github.com/matthijskooijman/pinoccio-firmware
- See http://apt.stderr.nl/pool/main/g/gcc-avr/gcc-avr_4.8-2.pinoccio1.tar.gz
Contains avr-gcc "02_support_rfr2.patch" used below
export PREFIX=/usr/local/avr
export PATH=$PREFIX/bin:$PATH
mkdir $PREFIX
cd $PREFIX
mkdir downloads src
cd downloads
wget ftp://sourceware.org/pub/binutils/releases/binutils-2.24.tar.bz2
wget http://www.netgull.com/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2
# Build avr binutils
# http://sources.redhat.com/binutils
cd ../src
bunzip2 -c ../downloads/binutils-2.24.tar.bz2 | tar xf -
cd binutils-2.24
mkdir obj-avr
cd obj-avr
../configure --prefix=$PREFIX --target=avr --disable-nls
make
make install
# Test new avr binutils
avr-as --help | grep -i rfr2 # Should see "atmega256rfr2"
# Build avr-gcc
# http://gcc.gnu.org
apt-get install libgmp-dev libmpfr-dev libmpc-dev
cd ../..
bunzip2 -c ../downloads/gcc-4.8.2.tar.bz2 | tar xf -
cd gcc-4.8.2
patch <02_support_rfr2.patch # See gcc-avr_4.8-2.pinoccio1.tar.gz
File to patch: gcc/config/avr/avr-mcus.def
mkdir obj-avr
cd obj-avr
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ \
--disable-nls --disable-libssp --with-dwarf2
make
make install
# Test new avr-gcc
avr-gcc -mmcu=atmega256rfr2 # Should not complain about an unsupported MCU type
# Build avr-libc
# http://savannah.nongnu.org/projects/avr-libc
cd ../..
svn co svn://svn.sv.gnu.org/avr-libc/trunk/avr-libc
cd avr-libc
./bootstrap
./configure --prefix=$PREFIX --build=`./config.guess` --host=avr
make
make install
# Build avrdude 6.1 (support for ATMega256RFR2)
# http://savannah.nongnu.org/projects/avrdude
apt-get install flex
cd ../..
gunzip -c ../downloads/avrdude-6.1.tar.gz | tar xf -
cd avrdude-6.1
mkdir obj-avr
cd obj-avr
../configure --prefix=$PREFIX
make
make install
# Test new avrdude
avrdude -c stk500 -p atmega256rfr2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment