Figure 2. Making an external tool.
Creating an Eclipse programming tool button.
You can use avrdude on the command line to program
your devices, but why? We’re already using the Eclipse IDE
to write and compile our programs; let’s use it to program
our boards too! In Figure 2, you can see the External Tools
button and the menu that comes up when you press the
right side of the button. If you just press the button, you’ll
execute the default action which will run your program
(which it can’t do right now). We want to configure a new
external tool, so press the right side of that button where
the down-arrow-looking thing is. Now select the External
Tools Configurations menu selection and you’ll get a dialog
box like what you see in Figure 3.
In the upper left side of this window is the New
Launch Configuration button (see the red arrow in Figure
3.) Click it and fill in the blanks as I detail here. Your
working directory will not be /home/dlc/workspace
obviously, so use the location that you selected when you
first ran Eclipse. There are four windows that you will have
to fill in properly:
Name: This is what you will call your tool to program
your project into the AVR part.
Figure 3. Create the programmer tool.
Location: This is where the program you’ll run is
located. If you followed my directions from last month, then
avrdude will be in /usr/bin/avrdude.
Working Directory: This is where your .hex file will be
located. If you stayed with the defaults that Eclipse offered
you (and you should, just to keep your life simple), then this
will be: /home/<login>/workspace/test328/Release.
Arguments: These are the command line arguments
that you feed avrdude to program your part. I’ll break this
line down in a moment; this is the most critical part of the
About avrdude arguments. Let me break down what is
written here, which deals with all of the hardware as I’ve
described it so far:
-c avrisp. The -c flag selects the download hardware. In
my case, it is the AVRISP. There are lots of different
programmers that you can have. If you look in
/etc/ avrdude.conf, you will see all of the ones that your
avrdude install knows about. If you have an AVRISP II (the
USB version), then you’ll have to compile avrdude yourself
with the USB extensions in it so that you can simply say –c
usb. For some reason, no install ever comes with avrdude
configured this way. Go figure. You can locate the
procedure here: www.arduino.cc/playground/
I know ... it talks about the bootloader, but the procedure
for building avrdude for use with USB programmers is
priceless. Every other place I looked had you jumping
through hoops with lex, yacc, bison (huh?). Some of these
Linux hacks must just love pain. If you want straightforward
AVR information, keep wandering through the Arduino
playground. These guys know their stuff and know that you
don’t want to be a compiler writer — you just want to
play with your AVR boards. Good stuff.
14 SERVO 05.2010
-p m328p. This defines the part you are
programming. If you type “man avrdude” in a terminal
window, you will get the man page for avrdude. It will
tell you all the parts that you normally want to use.
The /etc/ avrdude.conf file will have a full listing of the
currently supported AVR micros, as well.
-P /dev/ttyUSB0. This is where your serial port
linked for access to the USB/serial dongle. It is how
you talk to your programmer.
-U flash:w:test328.hex. “man avrdude” gives you
all of the possible options for the -U flag. This is telling
avrdude just what you want to do with your AVR micro.
This invocation programs the Flash program space.
After you get all of this entered, you can simply
hit the Apply and then the Close buttons to save the
If you have a “vanilla” MEGA328 part that you
just bought, its default setup configuration is the