thoralt.de
thoralt.de
avr-gcc 4.3.2+ under Mac OS X 10.5
27.11.2008
The only precondition for compiling avr-gcc under MacOS is that you have XCode installed (see Leopard installation DVD).
Download
Before you start, please download the following packages (choose the newest version of each package):
-GMP (GNU MP Bignum Library): http://gmplib.org/#DOWNLOAD
-MPFR (Multi Precision Floating Point Library): http://www.mpfr.org/mpfr-current/#download
-binutils (binary tools): http://ftp.gnu.org/gnu/binutils/
-binutils patch: http://www.thoralt.de/download/binutils-2.19-wrong-arch.patch
-gcc-core: http://gcc-uk.internet.bs/releases/ or choose another mirror: http://gcc.gnu.org/mirrors.html
-avr-libc: http://download.savannah.gnu.org/releases/avr-libc/
I assume that you saved all your files to your „Downloads“ folder. If this is not the case, please adjust the path names which are used below accordingly.
GMP
First we need the GMP library (GNU MP Bignum Library). It is necessary for compiling the avr-gcc. Please unpack the downloaded archive (double click on it). Then open a terminal window (e. g. use Spotlight and type „Terminal“ + Enter). Then execute the following commands:
cd #
cd Downloads/gmp-4.2.1
./configure
make
sudo make install
MPFR
Next we need the Multi Precision Floating Point Library (MPFR). It is also necessary for compiling avr-gcc. Unpack the archive with a double click, too. Then compile and install it:
cd #
cd Downloads/mpfr-2.3.2
./configure --disable-shared
make
sudo make install
binutils
The package „binutils“ is a group of several command line tools needed for processing of source code (e. g. the linker „ld“ and the assembler „as“). Unpack the archive. Unfortunately the version 2.19 of binutils comes with a bug which makes linking for some of the target processors of the AVR family impossible. To circumvent this, you need a small patch which is applied before you compile binutils. The patch file has to be copied into the binutils source folder, then execute the following commands:
cd #
cd Downloads/binutils-2.19
./configure --target=avr --program-prefix="avr-" --prefix=/opt/local
patch -p0 < binutils-2.19-wrong-arch.patch
make
sudo make install
gcc-core
This is the the actual compiler. Unpack, then execute:
cd #
cd Downloads/gcc-4.3.2
mkdir obj-avr
cd obj-avr
../configure --target=avr --program-prefix="avr-" --enable-languages=c
--prefix=/opt/local --disable-libssp
make
sudo make install
avr-libc
You‘re almost done, only „avr-libc“, the standard C library for AVR controllers, is missing. This is a special version which was upgraded with many platform specific functions. Again, unpack and execute the following:
cd #
cd Downloads/avr-libc-1.6.4
./configure --prefix=/opt/local --build=`./config.guess` --host=avr
make
sudo make install
Now your complete AVR toolchain is perfectly new and ready for using. The procedure for installing avr-gcc which is presented here was tested with the packages mentioned above. These instructions may not lead to success with future versions...
Lately I wanted to create a new AVR project based on the controller AT90USB162. Since I had only an obsolete tool chain, I had to compile a new one with support for this processor. It took almost two days until I had all sources and options together. Read on to find out how it‘s done.