==== Introduction ==== Here is a 'generic' step-by-step to getting an AVR development platform going on your computer using the free AVR toolchain (avr-gcc, avr-libc and avrdude) Pretty much every project uses this toolset so its a good way to get going Comments? Suggestions? Post to the [[http://www.ladyada.net/forums/|forum]]! ==== Mac Setup - Paths ==== The following two methods both place all of the files in the **/usr/local/bin** directory in the hard driver. Unfortunately that directory is not in the default path. That means that when you type **avrdude** into the terminal it cant figure out where to look. In this prep-step you'll change the profile of your Terminal to add **/usr/local/bin** to the path. Find the **Terminal** program, you'll be using this to do most of this stuff. Its in the Applications/Utilities folder {{ http://www.ladyada.net/images/minipov3/findterminal.jpg?nolink&438x351 |}} In the new Terminal window, type in echo $SHELL and press return If the output is **/bin/bash** then type the following command: \\ **echo 'PATH=$PATH:/usr/local/bin' >> ~/.bash_profile** \\ all on one line. Press return. If the output is **/bin/csh** or **/bin/tcsh **then type the following command: \\ **echo 'set path = ($path /usr/local/bin)' >> ~/.cshrc** \\ all on one line. Press return. Close any **Terminal** windows and open up a new one. This makes sure the **.bash_profile** or **.cshrc **is reloaded. Now type in **echo $PATH** (for bash) or **echo $path **(for t/csh) you should get something like the following: {{ http://www.ladyada.net/images/avrtutorial/echopath.gif?nolink&515x210 |}} The important thing is that at the end of the line is /usr/local/bin ==== Option 1. AvrMacPack ==== **This is the suggested method** [[http://www.obdev.at/products/avrmacpack/index.html|Download the ready to go nice package from ObDev,]] I havent tried it but a friendly email'er said its great. ==== Option 2. OSX-AVR \\ Step 1.Installing XCode ==== **This isnt suggested, and is an older method, but we leave the documentation here in case its handy** You will need **make** which is included in XCode, as OSX-AVR doesn't come with it (ugh) **Step 1. Download and install the mac developer tools (XCode). ** You need to have **make** installed, but it doesn't come with the OSXAVR package. You can try installing it with **fink**, which will require a lot less space but the following is guaranteed. If you want to have the latest avr-gcc you may also have to do it the "old way" which guarantees the most recent tools will be installed. To install **XCode** you will need the official packages. These are available on your Mac OS X Install CD, or from apple at: [[http://developer.apple.com/tools/|apple developer tools]]. The file is about 900MB so unless you have a fast connection I strongly encourage grabbing it off of the Install CDs that came with your Mac (you do still have those, right?) Basically we need the native Mac OS X compiler tools so that we can generate the AVR compiler tools. {{ http://www.ladyada.net/images/minipov3/xcodedl.jpg?nolink&749x533 |}} {{ http://www.ladyada.net/images/minipov3/xcodeopen.jpg?nolink&383x128 |}} {{ http://www.ladyada.net/images/minipov3/xcodeinstalling.jpg?nolink&620x440 |}} ==== Step 2. Install OSX-AVR ==== There's finally a good/fast way of installing all these tools under Mac OS X PPC or i386! First, download the [[http://www.digithink.com/OSX-AVR/Introduction/Main|OSX-AVR]] packge for[[https://sourceforge.net/project/showfiles.php?group_id=177221&package_id=204237&release_id=489171| PPC (older macs) or i386 (Intel macs, latest ones)]] from sourceforge. Run the OSX-AVR.mpkg You're done! (Images of installation and process are forthcoming but its rather easy so go ahead and try it anyways) Don't forget you have to install XCode as **make** doesn't come with this package. Can't get it working? Dont worry, help is available in [[http://www.ladyada.net/forums/|the forums]]! ==== Option 3. Old style, 'by hand' compilation ==== **This is the advanced method, for when you need bleeding-edge development and hackability. Not suggested** The following steps are essentially the same for MacOS X or Linux, BSD or any other unixy OS. This is the 'old style' of installing avr-gcc, its longer and more tedious but you are guaranteed to have the latest version. (Note that this doesn't seem to work on Intel Macs for unknown reasons, we're investigating...) [[http://tinyurl.com/26bl7xa/%7Ebuechley/diy/avr_mac_osx.html| Leah Buchley has an excellent tutorial]], and you should follow it. I've reduplicated it here in case the site goes down. (also with a few minor 'improvements' and images **Step 2. Download & install binutils (an essential utility for the C compiler)** Download the current release of binutils from : [[http://www.gnu.org/software/binutils/|http://www.gnu.org/software/binutils/]] (you can also go [[http://ftp.gnu.org/gnu/binutils/|straight to the download site here)]] For these examples, we'll be using **binutils-2.17.tar.gz** but you should use whatever is most recent. Save it into your home directory, not the desktop. {{ http://www.ladyada.net/images/minipov3/dlbinutils.jpg?nolink&443x334 |}} Decompress the downloaded file and double click on it to decompress it (or use Stuffit Expander, in the Applications folder). You should now have a folder called **binutils-2.17** which you should drag into your Home directory {{ http://www.ladyada.net/images/minipov3/binutilshome.jpg?nolink&585x365 |}} Open up a Terminal window and navigate to the binutils directory. Type: **cd binutils-2.17** (or whatever you downloaded) theb type in **ls** to verify everythings there {{ http://www.ladyada.net/images/minipov3/binutilsls.jpg?nolink&485x238 |}} Configure binutils for AVR. type: **./configure --target=avr** \\ this will start a long process that will spit out a lot of text. //**{{ http://www.ladyada.net/images/minipov3/binutilsconfig.jpg?nolink&485x238 |}}**// Once its done, compile binutils. type: **make** \\ this will start an even longer compilation process {{ http://www.ladyada.net/images/minipov3/binutilsmake.jpg?nolink&485x238 |}} \\ Once that's done, install binutils. type:** sudo make install** \\ You will be prompted to enter your password. Only administrators can install software thats why the password is necessary. {{ http://www.ladyada.net/images/minipov3/installbinutils.jpg?nolink&485x238 |}} ==== Step 3. Download & install gcc (the C compiler) ==== First, download the current release of gcc from: [[http://gcc.gnu.org/mirrors.html|http://gcc.gnu.org/mirrors.html]] currently thats gcc 4.2.0 {{ http://www.ladyada.net/images/minipov3/dlgcc42.jpg?nolink&443x210 |}} Decompress the downloaded file and put the decompressed folder in your home directory. Open up a new **Terminal** window in your home directory, type **cd gcc-4.2.0 **and then **ls** to verify its all in there. {{ http://www.ladyada.net/images/minipov3/gccls.jpg?nolink&515x364 |}} Next, c reate another directory to install gcc into. \\ type: **cd .. **//// to go back into the home directory, then \\ type: ** mkdir avrgcc-4.2** // //(substituting your gcc version for the 4.2) \\ Navigate to the folder you created. \\ type: **cd avrgcc-4.2**// // (or whatever you named your folder) \\ Configure gcc for AVR. \\ Type:** ../gcc-4.2.0/configure --target=avr --enable-languages=c --disable-libssp** \\ (substituting the name of the folder you decompressed for the gcc-4.2.0) \\ %%**%%thanks to [[http://web.media.mit.edu/%7Eraphael|Seth Raphael]] for the --disable-libssp tip {{ http://www.ladyada.net/images/minipov3/gccconfig.jpg?nolink&515x364 |}} Once the configuration is done, compile gcc. \\ type: **make CC="cc --no-cpp-precomp" **//// This will take a long time so go have a sandwich **{{ http://www.ladyada.net/images/minipov3/gccmake.jpg?nolink&515x364 |}}** When its done and you've washed your plate and silverware, install gcc. type: **sudo make install** //// \\ and enter your password when prompted {{ http://www.ladyada.net/images/minipov3/gccinstall.jpg?nolink&515x364 |}} ==== Step 4. Download and install avr-libc (an essential C library for AVR chips) ==== Download the current release of avr-libc from : [[http://download.savannah.gnu.org/releases/avr-libc/|http://savannah.nongnu.org/projects/avr-libc/]] Decompress the downloaded file and put the decompressed folder in your home directory In a new **Terminal** window, navigagte to the avr-libc directory. from your home directory \\ type: **cd avr-libc-1.4.6 **//// (or whatever you downloaded) {{ http://www.ladyada.net/images/minipov3/avrlibcls.jpg?nolink&515x280 |}} Configure avr-libc. type:** ./configure --host=avr **//// {{ http://www.ladyada.net/images/minipov3/avrlibcconfig.jpg?nolink&503x238 |}} Compile avr-libc. type: **make** {{ http://www.ladyada.net/images/minipov3/avrlibcmake.jpg?nolink&515x280 |}} Install avr-libc. type: **sudo make install** {{ http://www.ladyada.net/images/minipov3/avrlibcinstall.jpg?nolink&515x280 |}} ==== Step 5. Download and install avrdude (the software that loads programs from your machine onto the chips) ==== Download the current release of avrdude from : [[http://download.savannah.gnu.org/releases/avrdude/|http://download.savannah.gnu.org/releases/avrdude/]] Decompress the downloaded file and put the decompressed folder in your home directory In a Terminal window, navigate to the avrdude directory. From your home directory type: **cd avrdude-5.2** (or whatever you downloaded) \\ Configure avrdude. type:** ./configure** \\ Compile avrdude. type: **make** \\ Install avrdude. type: **sudo make install** Yay all the software is installed! Can't get it working? Dont worry, help is available in [[http://www.ladyada.net/forums/|the forums]]!