installing dev tools on os X

note: there’s alternate instructions at the bottom

wayyy easier, untested:

http://www.digithink.com/OSX-AVR/Introduction/Main

NOTE: YOU WILL NEED ADMINISTRATOR PRIVILEGES TO COMPLETE THIS INSTALLATION! ALSO, THIS INSTALLATION HAS BEEN A LITTLE DIFFERENT ON EVERY MACHINE I’VE TRIED IT ON, SO PREPARE FOR SEVERAL HOURS OF TRIAL AND ERROR, GOOGLING, AND BEING EXTREMELY FRUSTRATED.

1. Download and install XCode Tools

XCode is available at:

http://developer.apple.com

you must be registered as an Apple developer to download XCode (it’s free, or if you’re a student you should consider registering as a student developer for a small fee because you get a generous hardware discount).

2. Download and install binutils

download binutils-2.16 from:

http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz

once you’ve downloaded binutils, extract it (just double-click on the file). you should have a folder called binutils-2.16.

open the Terminal application (/Applications/Utilities/Terminal.app). cd into the binutils-2.16 folder like this:

agentcooper:~ lake$ cd /tmp/binutils-2.16/

then configure, make, and install like this:

agentcooper:/tmp/binutils-2.16 lake$ ./configure --target=avr
agentcooper:/tmp/binutils-2.16 lake$ make
agentcooper:/tmp/binutils-2.16 lake$ sudo make install

you will be prompted for your administrator password. once make install has finished, cd into the bfd directory.

agentcooper:/tmp/binutils-2.16 lake$ cd bfd/

configure, make, and install libbfd:

agentcooper:/tmp/binutils-2.16/bfd lake$ ./configure --target=avr  
 --disable-nls  –-enable-install-libbfd
agentcooper:/tmp/binutils-2.16/bfd lake$ make
agentcooper:/tmp/binutils-2.16/bfd lake$ sudo make install

then cd into the binutils-2.16/libiberty directory

agentcooper:/tmp/binutils-2.16/bfd lake$ cd ../libiberty/

and again configure, make, and install libiberty:

agentcooper:/tmp/binutils-2.16/libiberty lake$ ./configure --target=avr 
  -disable-nls -enable-install-libiberty --prefix=/usr/local/avr
agentcooper:/tmp/binutils-2.16/libiberty lake$ make
agentcooper:/tmp/binutils-2.16/libiberty lake$ sudo make install

3. Download and install gcc-3.4.3 with an avr target

first make sure that /usr/local/bin is in your path. /usr/local/bin is software from step 2 was installed. you can add /usr/local/bin to your path like this if you are using bash as your shell (if you don’t understand what this means, you are probably using a bash shell):

agentcooper:/tmp/binutils-2.16/bfd lake$ export PATH=$PATH:/usr/local/bin

change directories to the newly extracted gcc folder:

agentcooper:/tmp/binutils-2.16/bfd lake$ cd ../../gcc-3.4.3/

configure, make, and install gcc like this:

agentcooper:/tmp/gcc-3.4.3 $ ./configure
 -target=avr -enable-languages=c
agentcooper:/tmp/gcc-3.4.3 $ make CC=”cc –no-cpp-precomp”
agentcooper:/tmp/gcc-3.4.3 $ sudo make install

4. Download and install avr-libc

download avr-libc from:

http://download.savannah.gnu.org/releases/avrlibc/avr-libc-1.4.4.tar.bz2

and extract it.

cd into the the avr-libc directory:

agentcooper:/tmp/gcc-3.4.3 $ cd ../avr-libc-1.4.4

then configure avr-libc like this:

agentcooper:/tmp/avr-libc-1.4.4 lake$ ./configure --build=powerpc-apple-darwinX.X.X –-host=avr

where X.X.X is the version number of your kernel. you can run

agentcooper:/tmp/avr-libc-1.4.4 lake$ ./config.guess

to get a guess at the version number. the output of this script on my machine is ‘powerpc-apple-darwin8.6.0’. on intel machines you may have to set the build to something like ‘i686-apple-darwin8.6.1’. now run make and make install like this:

agentcooper:/tmp/avr-libc-1.4.4 lake$ make
agentcooper:/tmp/avr-libc-1.4.4 lake$ sudo make install

5. Download and install GDB

if your planning on doing in-circuit debugging, you probably want to download and install gdb. gdb is available at:

http://ftp.gnu.org/gnu/gdb/gdb-6.0.tar.gz

once you’ve downloaded and extracted gdb, cd into the gdb directory like this:

agentcooper:/tmp/avr-libc-1.4.4 lake$ cd ../gdb-6.0

then configure, make, and install gdb like this:

agentcooper:/tmp/gdb-6.0 lake$ ./configure --target=avr
agentcooper:/tmp/gdb-6.0 lake$ make
agentcooper:/tmp/gdb-6.0 lake$ sudo make install

6. Download and install AVaRICE

avarice is necessary to program and debug your avr using atmel’s avrjtag ice. avarice is available at:

http://avarice.sourceforge.net/

the latest version is avarice-2.4. once you have downloaded and extracted avarice-2.4, cd into the avarice-2.4 directory like this:

agentcooper:/tmp/gdb-6.0 lake$ cd ../avarice-2.4
agentcooper:/tmp/avarice-2.4 lake$ ./configure LDFLAGS=”-L/usr/local/powerpc-apple-darwinX.X.X/avr/lib 
 –lbfd –L/usr/local/avr/lib” CPPFLAGS=”-I/usr/local/avr/include”

where powerpc-apple-darwinX.X.X is the version of your kernel, e.g. powerpc-apple-darwin8.6.0 or i686-apple-darwin8.6.1. then run

agentcooper:/tmp/avarice-2.4 lake$ make
agentcooper:/tmp/avarice-2.4 lake$ sudo make install

avarice is the component I’ve had the most trouble getting to install. if this doesn’t work for you, look at:

http://avarice.darwinports.com (not tested)

alternate instructions

I have now installed the toolchain. The procedure was slightly different from the one detailed in the walkthrough. I used the following tools, versions and shell commands to perform the install:



Preparation
===========

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

binutils 2.17
=============

$ cd binutils-2.17
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX --target=avr --disable-nls
$ make
$ sudo make install

libbfd
======
$ cd binutils-2.17/bfd
$ mkdir obj-avr
$ cd obj-avr
$ ../configure prefix=$PREFIX --target=avr --disable-nls  --enable-install-libbfd
$ make
$ sudo make install

gcc 4.1.1
=========

$ cd gcc-4.1.1
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX --target=avr --enable-languages=c --disable-nls --disable-libssp
$ make
$ sudo make install

avrlibc
=======

$ cd avr-libc-1.4.5
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX --build=`../config.guess` --host=avr
$ make
$ sudo make install

avrdude
=======

$ cd avrdude-5.2
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX
$ make
$ sudo make install

gdb
===

$ cd gdb-6.5
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX --target=avr
$ make
$ make install

Alternate alternate instructions (5/12/08): A much easier and cleaner method than any of the above is to simply install MacPorts. Just go to http://www.macports.org/ and follow the instructions to install the basis of MacPorts, then once it’s installed, open a terminal and run:


sudo port install avarice
sudo port install avr-gdb
sudo port install avr-gcc

This will automatically build and install the compiler, debugger and JTAG interface software, as well as other required components such as binutils, libc for AVR, etc. I (nickca) have tested this by using it to build the 40h firmware and flash it to the AVR using an Olimex AVR JTAG ICE MkI clone.

Edit this page or watch for changes using RSS.