beautypg.com

B. programming avrs in mac os x, Installing crosspack, Using avrdude – Pololu USB AVR User Manual

Page 39

background image

If you are using Mac OS X 10.7 or later and have not changed the programmer’s firmware, there should be two
new

/dev/tty.usb*

entries. The entry with the lower number is your programmer’s Programming Port, and later you

will need to pass its name as a parameter to AVRDUDE. The entry with the higher number (which should be two plus
the lower number) is the TTL Serial Port, and you can use a terminal program such as

screen

to send and receive

bytes from it.

If you are using an older version of Mac OS X, you will need to install the modified firmware as described above,
and you should only see one new

/dev/tty.usb*

entry. This is your programmer’s Programming Port, and later you

will need to pass its name as a parameter to AVRDUDE.

5.b. Programming AVRs in Mac OS X

If you have an Orangutan or 3pi Robot or wish to use the Pololu AVR C/C++ Library for some
other reason, we recommend following the

Pololu AVR Programming Quick Start Guide

[http://www.pololu.com/docs/0J51]

instead of this tutorial.

Installing CrossPack

To program AVRs in Mac OS X, you will need the free avr-gcc compiler, avr-libc, AVRDUDE, and other associated
tools.

1. Download the

CrossPack for AVR Development

[http://www.obdev.at/products/crosspack]

, which is packaged as

a .dmg file.

2. Open the .dmg file, and double-click on CrossPack-AVR.pkg. This package will create a sub-directory
called CrossPack-AVR- on your hard drive (probably under /usr/local), along with a version-
neutral symbolic link CrossPack-AVR referencing the same sub-directory. It will also add an entry to the PATH
environment variable referencing CrossPack-AVR/bin.

3. Programs for the AVR can now be compiled at the command line using the avr-gcc C compilers and the
avr-as assembler. For detailed instructions, see the CrossPack development manual, which is installed in the
CrossPack-AVR directory along with the tools.

Using AVRDUDE

Once an AVR program has been compiled to a .hex file, it is ready to be flashed to the AVR. The AVRDUDE program
(which was installed as part of the CrossPack package) may be used for this purpose.

To see the full command-line syntax for AVRDUDE, type

avrdude

--help

at the command line, or consult

the

AVRDUDE documentation

[http://www.nongnu.org/avrdude/user-manual/avrdude.html]

. Typical usage would be as

follows:

avrdude -p -c avrisp2 -P -U flash:w:.hex

For example:

Pololu USB AVR Programmer User's Guide

© 2001–2014 Pololu Corporation

5. Getting Started in Mac OS X

Page 39 of 54