General outline for creating AVR development environment for OSX.
Since the gcc chain serves a much greater community than just the avr and its stability is critical to the stability of the entire open software community the avr community has elected to maintain patches. The avr-binutils, avr-gcc and patches used are all to be found in the freebsd ports collection. The avr-libc does not require patching as it is seperate from gcc.
(If you would rather just download and install the resulting package it is here)
Process for multiple installations
- create a staging directory.
- patch, build and install (in order)
- avr-binutils
- avr-gcc
- clean and then rebuild them into the staging directory.
- build avr-libc into ste staging directory.
- use PackageMaker to build a package.
- add README and other utilities you want to include
- use disk-utility to create DMG
- mount and install the package
- put the dmg where it can be shared.
avr-binutils
The the binary utilities make up the loader and assemblers and other tools needed by gcc to create usable code for the target. Like gcc the binary utilities are not specific to the target but are built for the target. I built the binutilities out of the freebsd currents distfiles (ftp://ftp.freebsd.org/pub/FreeBSD/distfiles), and then applied all of the patches from the freebsd cvs directory (http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/avr-gcc/files/). The patch that changes most often is the new-devices patch which Jeorg Wunsch updates in order to keep the avr-libc current. Then the source tree is unpacked and “./configure”d with the –targe=avr flag. (For some reason I also had to –disable-nls to get this to work).
# tar -xzvf binutils-xxx # cd binutils-xxx # for p in ${avr-binutils-patches}/* ;do patch<$p done # /configure --target=avr --disable-nls # make && make install && make clean
avr-gcc
Once the avr-binutils are built and installed gcc is built exactly the same way.
# tar -xzvf gcc-xxx # cd gcc-xxx # for p in ${avr-gcc-patches}/* ;do patch<$p done # /configure --target=avr --disable-nls
avr-libc
The libc for avr avr-libc is a seperate package from binutils and gcc and it is updated often. You can build this directly into the staging directory. If you are not preparing the code for packaging then you can build the libc directly into the target directory.
# tar -xzvf avr-libc-xxxx # cd avr-libc-xxxx # ./configure CC=avr-gcc --host=avr # make && make install && make clean
Preparing the code for packaging.
If you are going to deploy the avrgcc chain on more than one system or if you want to back up and or share the software then you should at this point rebuild both binutils and gcc into a staging directory.
# rm -rf /usr/local/staging # mkdir /usr/local/staging # cd /usr/local/src/avr-gcc/binutils-xxx # /configure --target=avr --prefix=/usr/local/staging --disable-nls # make && make install && make clean # cd ../../avr-gcc/gcc-xxx # /configure --target=avr --prefix=/usr/local/staging --disable-nls # make && make install && make clean # cd ../../avr-libc/ # tar -xzvf avr-libc-xxxx # cd avr-libc-xxxx # ./configure CC=avr-gcc --host=avr --prefix=/usr/local/staging # make && make install && make clean
PackageMaker
One of the applications included in the X-code suite is packagemaker. On my installation it is found under the folder in Developer->Applications->Utilities. PackageMaker can also ge called from the command line but this will require further investigation. .
- open packagemaker
- in the first tab describe the software.
- in the second tab (files) type the path of the staging directory (in our case /usr/local/staging)
- in the forth tab (info)
- put the default location of the software (/usr/local/)
- set the authorization required to “root authorization required”
- fill out the information as appropriate.
- create the package (command-K)
Creating the Disk image.
Once the package is created
- copy the resulting package into its own folder.
- You should probably create a readme file
- add any other software you want in your archive.
- open the Disk Utility (under Applications->Utilities)
- under the images menue select New->Image from folder