AVR microcontroller development from the command line

Note that the linux gadget "picocom" works just fine to talk to a microcontroller via a USB "serial port" like /dev/ttyACM0". I recommend it, and find it far superior to and simpler than minicom.

To get out of picocom type the two character salute ^A^X. And this is a fantastic feature: you can go up and down the set of known baud rates using ^A^U to go up and ^A^D to go down. Pure genius! Look at the man page via "man picocom" to get the rest of the story.

The AVR toolchain

I am doing AVR development on a linux system, and the first thing to do in order to get going is to install the AVR toolchain. If you are developing on Windows, you have my sympathy. In that case, AVR Studio is the windows hosted AVR development environment and what you want.

Happily there is a Gnu gcc based C cross compiler for the AVR chips. It is supplied (and perhaps even maintained and updated) by Atmel, the chip vendor. An enlightened approach, bless their hearts.

yum install avrdude
yum install avr-gcc
yum install avr-binutils
yum install avr-libc
yum install avr-libc-doc
yum install avr-gdb
Also (maybe) someday:
yum install uisp
yum install simulavr
yum install simulavr-doc
yum install avr-gcc-c++ (not likely)
Honestly you could probably just do "yum install avr\*" and be happy.


The program "avrdude" is the device programming utility, and it has a nice manual, and amazing features - including a terminal mode.

Some successes

Interesting Links

One thing you immediately discover when you head down this path is a vibrant and enthusiastic culture of "AVR Hackers". A lot of sharp people are working with these devices. I'll note that the Procyon "avrlib" was last updated in September, 2005 and has trouble compiling with the latest avr-gcc -- however it should be a great starting point for new efforts.

The AVR Freaks website is a great resource, taking you well beyond the Arduino and into the more generic world of programming the Atmel AVR chips.

The articles at "AVR Freaks" are useful, but rather Windows-centric (AVR Studio is the windows hosted AVR development environment).

Other peoples AVR Makefiles

Learning from the Arduino

I began working with AVR controllers using the Arduino environment. It seemed like a resonable idea to find out what the Arduino GUI was doing "behind the scenes" to build a project. Ultimately this was a lot of wasted time, but I append my notes and lessons learned here anyway.

What I did learn was that an Arduino "sketch" is a fragment of C++ code. It is merged with some boilerplate C++ code, and then compiled with avr-c++ and linked against a bunch of Arduino libraries. Something like a makefile is produced, but is not kept around in any handy way for inspection. All in all this was difficult, frustrating, and unproductive. It was clearly not something you were expected to be doing.

Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org