Skip to content

Instantly share code, notes, and snippets.

@kevinmehall
Created October 20, 2012 23:42
Show Gist options
  • Save kevinmehall/3925264 to your computer and use it in GitHub Desktop.
Save kevinmehall/3925264 to your computer and use it in GitHub Desktop.
Compiling the Atmel-patched AVR toolchain

#Compiling AVR toolchain

http://distribute.atmel.no/tools/opensource/Atmel-AVR-Toolchain-3.4.1/avr/

Binutils

Rebuild configure script with autoconf in root and in bfd? May need to hack the Makefile.am if the autotools version is wrong.

(cd bfd; ./configure && make headers)

TARGET=avr
build_platform=$(shell uname -i)-pc-linux-gnu
host_platform=$(shell uname -i)-pc-linux-gnu
ATMEL_VERSION=3.4.1


mkdir build; cd build;

../configure     --build=$(DEB_BUILD_GNU_TYPE) \
	--host=$(DEB_HOST_GNU_TYPE) \
	--target=$(TARGET) \
	--host=${host_platform} \
	--build=${build_platform} \
	--with-pkgversion="AVR_8_bit_GNU_Toolchain_${ATMEL_VERSION}_ppa" \
	--with-bugurl="http://www.atmel.com" \
	--disable-nls \
	--disable-werror \
	--enable-install-libiberty \
	--enable-install-libbfd \
	--prefix=/usr/lib \
	--infodir=/usr/share/info \
	--mandir=/usr/share/man \
	--bindir=/usr/bin \
	--libexecdir=/usr/lib \
	--libdir=/usr/lib \

make -j5
make install

GCC-AVR

Apply patch from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51969 if building with GCC 4.7 host compiler.

mkdir build; cd build;

../configure 	--build=$(DEB_BUILD_GNU_TYPE) \
	--host=$(DEB_HOST_GNU_TYPE) \
	--target=$(TARGET) \
	--host=${host_platform} \
	--build=${build_platform} \
	--with-pkgversion="AVR_8_bit_GNU_Toolchain_${ATMEL_VERSION}_ppa" \
	--with-bugurl="http://www.atmel.com" \
	--with-dwarf2 \
	--enable-doc \
	--disable-shared \
	--disable-libada \
	--disable-libssp \
	--disable-nls \
	--enable-languages=c,c++ \
	--enable-fixed-point \
	--prefix=/usr/lib \
	--infodir=/usr/share/info \
	--mandir=/usr/share/man \
	--bindir=/usr/bin \
	--libexecdir=/usr/lib \
	--libdir=/usr/lib \

make -j5
make install

If using a build system, make sure it does not automatically try to strip all binaries, as amd64 strip will mangle the AVR libs.

AVR libc

Extract their separate headers tarball as avr-headers

cp avr-headers/io[0-9a-zA-Z]*.h include/avr/

./bootstrap

mkdir build; cd build;

../configure    --build=$(DEB_BUILD_GNU_TYPE) \
	--host=avr \
	--target=$(TARGET) \
	--prefix=/usr/lib \
	--infodir=/usr/share/info \
	--mandir=/usr/share/man \
	--bindir=/usr/bin \
	--libexecdir=/usr/lib \
	--libdir=/usr/lib \

make -j5 
make install

If using a build system, make sure it does not automatically try to strip all binaries, as amd64 strip will mangle the AVR libs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment