2011-04-22

avr-gcc環境の構築

Linux上で、AVR用GCCツールチェインを構築します。

用意するファイル

gccは2011/04/22現在、4.6.0が最新ですが、コンパイル中にエラーが出ました。4.5.2はATTINY2313に対応していないそうです。どうしてもという方は、 http://weepro.blogspot.com/2011/03/avr-gccgcc-452.html を参考にしてみてください。ここでは、問題の無かった4.4系の最終版であるgcc-4.4.5を採用しました。

手順

前述のアーカイブをすべて展開しておきます。

su
export PATH=/usr/local/avr/bin:$PATH

cd gmp-5.0.1
mkdir build
cd build
../configure --prefix=/usr/local --disable-shared
make
make install
cd ../../

cd mpfr-3.0.1
mkdir build
cd build
../configure --prefix=/usr/local --disable-shared --with-gmp=/usr/local
make
make install
cd ../../

cd mpc-0.9
mkdir build
cd build
../configure --prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local
make
make install
cd ../../

cd binutils-2.21
mkdir build
cd build
../configure --prefix=/usr/local/avr --target=avr --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-nls
make
make install
cd ../../

cd gcc-4.4.5
mkdir build
cd build
../configure --prefix=/usr/local/avr --target=avr --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-languages=c,c++ --enable-long-long --disable-shared --disable-libada --disable-libssp --disable-nls
make
make install
cd ../../

cd avr-libc-1.7.1
mkdir build
cd build
../configure --prefix=/usr/local/avr --host=avr
make
make install
cd ../../