Tuesday, October 25, 2011

Compiling firmware for Atmel chips

First, you'll need the development environment, which includes an editor and a compiler.  I like AVR Studio 4.  They have a much newer version, but I don't like it as it's incredibly bloated for what I do.

Search the web for AVR Studio 4.  Atmel maintains an archive of older versions. Download the latest version of 4 (this should be version 4.19).

Run the setup.  The defaults should be fine.

Now install WinAVR.  This contains the actual compiler we want to use (avr-gcc).  Get it here:
http://sourceforge.net/projects/winavr/files/

If you're running Windows 8 or higher, the Make in WinAVR won't work as distributed.  Download this file and install it in winavr's util/bin directory after installing WinAVR:
http://www.madwizard.org/download/electronics/msys-1.0-vista64.zip

To compile an existing project, open up the (projectname).aps file in the project's directory.

Under Project/Configuration Options, go to Custom options and uncheck "Use AVR toolchain" then set avr-gcc to your path to avr-gcc.exe from the WinAVR install.  It should be 

C:\WinAVR-20100110\bin\avr-gcc.exe

Similarly, set the path to make.exe.  It should be:

C:\WinAVR-20100110\utils\bin\make.exe

You should now be able to hit Build/Build and have it compile.  Your HEX file is the end goal, it should be in the "default" directory.  Now you can put that into your chip and try it out.

No comments:

New printer: JGAurora A3

This week I decided I'd had it with all the other printers in my stable.  The CTC is stable and decent but it just bugs me (can't st...