Open Source Project
Follow along with this
series! Joe’s book & kits
are available at
by Joe Pardue
Last month, we learned how to create an open source
project on Google Code using avrtoolbox as an example
[ http://code.google.com/p/avrtoolbox]. We also learned
how to manage the software versions using TortoiseSVN.
This month, we will look at the design philosophy for
avrtoolbox, and a project C coding and documenting style
guide. One of the things we intend for avrtoolbox
(remember this is a we project — ‘collaborative’ and
‘open’) is that it will be usable by everyone interested in
AVR microcontrollers — from the greenest novice to the
most experienced professional. Oh yes, we are ambitious!
We want an elementary library with tutorials designed
for novices (someone who has never ever used a
microcontroller or programmed in C) so they are easy to
learn and use just like systems such as the Arduino or the
BASIC Stamp. We want to build this elementary library
from lower level libraries that can be easily expanded by
advanced users who need professional quality AVR C
programming tools. These goals may seem at odds —
mixing novice and professional libraries in the same project
— but they are actually just the ends of a programmer
competence spectrum that doesn’t have any formal
dividers. All real people are somewhere in between. Oh,
and a word of warning. Most of what follows this month is
for avrtoolbox developers, so novices might want to skim
a lot of this and consider it a sort of coming attractions
featurette – but please do read the last section.
Design Philosophy Statement
avrtoolbox is a collection of open source educational
tools for learning about and using Atmel AVR (eight-bit)
microcontrollers with the standard Atmel AVR Toolchain:
60 March 2011
• libraries – Useful C functions.
• avr_applications – Complete programs for the AVR.
• pc_applications – Terminals, IDEs, etc.
• documentation – avrtoolbox documents.
• hardware – Schematics and layouts.
• miscellaneous – Useful stuff that doesn’t fit elsewhere.
Because the AVR architecture varies among sub-families, it would be very difficult to create compiled
hardware libraries that could be run on all possible AVR
variants. Our initial approach will be to create a single
source code repository where all the code will be
developed for and tested on three different AVRs available
on inexpensive development boards. This will demonstrate
concepts for writing code that can be compiled for
multiple devices and leave it to the users to follow the
methods shown to add additional devices as needed.
The three AVRs we will use are the ATmega169,
ATmega328, and ATmega644; we will test our tools on
three development boards: Butterfly (ATmega169),
Arduino Duemilanove or Uno Boards (ATmega328), and
the BeAVR (ATmega644)
For the Arduino board, this system does not use the
Arduino IDE nor is it compatible with the existing Arduino
libraries. The BeAVR – Breadboard enabled AVR – was
shown in the May ‘ 10 Smiley’s Workshop.
AVR Source Code Libraries
The lower level directory structures will evolve over
time, but to begin, the libraries’ directory will have five
libraries – Useful C functions.
• elementary – High level simple functions similar to
those in Arduino or PBASIC.
• general – Useful embedded system software that is not
• driver – AVR specific software.
• board – Custom functions for development boards such
as the Butterfly.
• testers – Test software for each library.