Our resident expert on all things
robotic is merely an email away.
roboto@servomagazine.com
Tap into the sum of allhumanknowledge and get your questions answered here!
From software algorithms to material selection, Mr. Roboto strives to meet you
where you are — and what more would you expect from a complex service droid?
by
Dennis Clark
Q. Our club is making a club robot based on the
Atmel ATMEGA168. About half of the members
use either Mac OS X or Linux, not Windows. What
can we use to program our robots that isn’t Windows only?
A. Many fellow robot makers out there know that I am
a Mac fan and go out of my way to do just what you
are asking about. Sometimes there is no choice and
for that, I have a Windows laptop. BUT, in this case you
do indeed have an option: avr-gcc. Avr-gcc is gcc, the
open source C and C++ compiler of choice for many
environments, customized for AVR programming. This
environment can be used on Windows (usually Winavr),
Linux, and the Mac OS. In this column, I’m going to detail
where to find the parts, how to install them, and how to
configure it all to program your robots. These packages
usually want OS X 10. 3. 9 minimum; I recommend 10. 4
(Tiger) to play in. (Mostly because that is what I used —
that and Leopard — so I know that it works.)
Setting up a Mac to program
AVR microControllers
There are three pieces of the puzzle that you will
need to get:
1) Macpack AVR: This is avr-gcc and has all kinds of utilities
and goodies. Top on
Figure 1. Macpack AVR install volume. the list is avrdude,
one of the most
popular AVR
programmer
programs. You can
find this Mac-friendly
install package here:
www.obdev.at/
products/avrmac
pack/download-de.
html — get the most
20 SERVO 08.2008
recent version. It will come in a “dmg” package.
2) Eclipse Europa for C/C++ programming. This is a Java-based IDE that can be customized for just about anything.
Like gcc, it too is open source based. You can find the latest
here: www.eclipse.org/downloads/. Get the one for
C/C++ development. This will be a gzip’d tarball (in the
UNIX parlance) that your computer will know about.
3) AVR plug-in for Eclipse. This customizes the Eclipse IDE
for use with the AVR toolchain. You can find it here:
http://avr-eclipse.sourceforge.net/. I got the plug-in
directly from the web page; they tell of a way to get it from
Eclipse too, but call me cautious, I went for the sure thing.
Installing Macpack AVR
To install Macpack AVR, simply double-click on the
downloaded file; in my case, it was called AVRMacPack-
20080514.dmg. It will mount a drive called AVRMacPack
on your desktop; in there, you’ll find a readme file and an
install package. Read the former and double-click on the
latter to install avr-gcc (see Figure 1).
The installer is very nicely done and, of course, you
must enter your admin password since this is going to be
installed in UNIX system directories. In this case, in
/usr/local/AVRMacPack. You are now delving into the realm
of command line interfaces, so take a deep breath and look
in your Applications/Utilities folder and find “Terminal.”
Install it on your dock; you’re going to be using it a bunch
now. Avr-gcc, via AVR MacPack, has the version 3 and
version 4 compilers. Lots of the new work is being done in
version 4, but some like to use version 3. I recommend that
you just issue this command on the command line in your
terminal “avr-gcc-select 4” and use the latest. Figure 2
shows how this dialog might look. Remember, all of this is
free, so you won’t get much hand-holding as you do with a
full-fledged IDE, but we’re not done setting up. Let’s wait
until we get Eclipse and the AVR plug-in installed before we
play with avr-gcc any more.