Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in /home/ngakeruc/public_html/index.php on line 3
Mike Seeman: AVR Microcontroller Programming on Mac OS X

This is a quick how-to for a low-cost programming solution for Atmel AVR microcontrollers. The following instructions are meant for MacOS X (10.1 or later recommended), although many can be adapted to Linux. OS 9 is (for the most part) incompatible with these instructions.

GNU C Compiler
To create and compile C code for the AVR microcontrollers, I use the GNU gcc compiler. The easiest way of getting the GNU tools is to download my newly updated installer package from my web site. It should work, but if it doesn't work, let me know. Note: The package is completely up to date as of February 3, 2004.

The package contains:
Download: avr_gcc_macos_x.dmg (14.9 MB).
Jaguar (and probably Panther) Users: See note at the end of this section.

GCC can also be downloaded and compiled under MacOS X, although first you must install the developer tools from the Apple CD, which came with OS X, or can be downloaded from the Apple website for free. A good reference for the AVR GCC tools and the C library can be found at However, the instructions for compiling the tools is somewhat outdated. Here is what I use to compile the tools:

First, download the latest version of binutils and gcc or gcc-core (see note) from your favorite gnu mirror (see Then download the latest avr-libc from The first two downloads are quite large, so think twice if you use a modem. Then run the following commands to compile binutils:

tar -xzf binutils- (or whatever you downloaded, if not already decompressed)
cd binutils- (or whatever you decompressed)
./configure --target=avr
sudo make install (you'll have to type in your password to enable root access)

To compile gcc:
tar -xzf gcc-core-3.2.1.tar.gz (or whatever you downloaded)
cd gcc-3.2.1 (or whatever you decompressed)
./configure --target=avr --enable-languages=c
make CC="cc -no-cpp-precomp"
sudo make install

To compile avr-libc:
tar -xzf avr-libc-20020203 (or whatever you downloaded)
cd avr-libc-20020203 (or whatever you decompressed)
sudo ./domake install


  • With Jaguar (OS 10.2), the path /usr/local/bin isn't automatically added to the search paths, so add the following to your .cshrc file or create a .cshrc file with:
    set path = ( $path /usr/local/bin )
    You'll need to do this before compiling any of the tools.
  • With versions later than 3.0.3, the options to make when building are necessary for gcc to compile right. You should also make sure you get the latest developer tools from Apple.
  • Developer tools before July 2002 or so requre GCC 3.2.x or earlier. Newer versions (cvs as of now) need GCC 3.3 or later.
  • Many warnings are typical when compiling the tools. Don't worry, unless you get a fatal error (something that stops the compile).
  • I haven't experienced this problem myself, but I've gotten two complaints saying that avr-gcc cannot find the library libiconv.2.dylib in /usr/local/lib. It may be found in the /lib/ directory and be copied into /usr/local/lib. This may or may not work for you.

Code Editor
To edit AVR C code, I recommend using Emacs, the standard UNIX text editor. Although it takes a bit of time to get used to, it has many keyboard shortcuts, syntax highlighting, auto-tabbing and other features. Or you could just use any old text editor, or Codewarrior (if you have it).
You can get the latest Aqua Emacs from Or for Jaguar (10.3), try
A page of Emacs key shortcuts can be found at

Software Programmer
My Java programmer is obsolete, although instructions and source are still available.

I recommend using uisp to program AVR chips. uisp is the most capable open-source programmer under Linux. Download the latest version of the source from The uisp program is also included in my installer.

To compile the program, run (inside the expanded uisp directory):
sudo make install

I've tested this using Jaguar (10.2.3) and uisp 20021201, and it seems to work fine.
If you type uisp --help (you need to open a new terminal window after compiling), you will get a number of options to use with uisp. My typical use of uisp line is as follows:
uisp -v -dprog=avr910 -dspeed=19200 -dpart=auto --erase --upload --verify if=< file.rom >

Other Software
To debug microcontroller projects, it is useful to have a serial port on the project and spit out data to the serial port. A terminal program is used on the PC to read in this data. I recommend Zterm ( for a graphical interface, or minicom ( for a text-based interface. You can use the same USB to serial adapter for this purpose.

Serial Programmer
To program the AVR microcontrollers on a Mac, you first need a serial (not parallel) programmer. Several of the AVR STK's come with a serial programmer and it is also possible to build your own programmer. Instructions can be found in Application Note 910 on Atmel's web site (
Another excellent site to look at for programming tools is
In addition, Digi-key sells a serial programmer that supports almost all AVR chips (unlike the appnote 910 programmer) for $30. It is part number ATAVRISP-ND. Note that this programmer requires a 115,200 bps serial port to work.

USB Serial Adapter
Since recent Macs don't have serial ports, you need a USB to Serial Adapter, availible from several companies. I recommend one from Keyspan, as they are the only company (as of late 2001) that makes OS X and linux drivers for their products. I use the Keyspan USB PDA Adapter, because it is cheap (about $39.99). It only works up to 57600 baud, which is fine for the homebrew serial programmer. If you use the Atmel AVRISP, a faster adapter is needed, for instance the Keyspan High Speed USB Serial Adapter.

USB Programmer
An alternative to getting a serial programmer and a USB to serial adapter is to make (or buy) a USB programmer. I haven't had any experience with them, but in a single day, I received two emails about these. Try these links:

Application Example
This simple example uses a microcontroller to blink an LED using timer interrupt based timing. The sample code and procedures are based on the hardware shown in this schematic.
The sample code is written in C (C++ is not really supported on AVR, and is not really useful at this scale). AVR specific commands (in the avr-libc library) are described at The sample code is relatively well commented, and should be straightforward to understand.
Since the GNU tools are based on the command line, one must use the Terminal application to compile the code. I recommend using make to simplify the compile process. make uses a makefile (it must be called makefile) that contains the dependencies of various targets and the command needed to make them. An example makefile is included below.

Notes and Future Development
This is an ongoing project. If you have any corrections to the information I provided or suggestions or comments, feel free to email me using my contact page.