Taking the Training Wheels off the Arduino

Arduino boards are cool pieces of hardware. They are small, very flexible, and easy to use. Arduino boards are well designed and come with a lot of example code, good documentation, a strong community, and have lots of geeky add-on hardware known as shields. In comparison, few other options are as well suited to introduce embedded programming to people who haven’t had much exposure to it.

Arduino boards are normally programmed with the Arduino Programming Language which is based on the C programming language. The Arduino also ships with its own IDE which greatly simplifies the task of getting code running on an Arduino. This setup is excellent for beginners, but what if you want to start working outside of this IDE? What if you want or need to write raw C? What if you want an environment that’s a little more conducive to an automated build process?

If you’ve wanted to bump your Arduino environment up (or down?) a notch, then do I have something handy for you!

I often find myself needing to step outside the typical Arduino environment. For these cases, I have a tool-set I’ve grown to enjoy and an environment that helps me get things off the ground quickly. I’ve compiled all components into a scaffolding that should help ease the pain of taking the training wheels off the Arduino UNO (the scaffold should also work for other boards with slight tweaks). For build automation, I’ve selected Rake. The C compiler and linker are the avr-gcc toolchain. avrdude is used to put the software onto the Arduino.

First off, the scaffolding lives on Github in the Throw The Switch organization as the Arduino C Scaffold project. This should have everything you need to deploy a C project on an Arduino UNO without the Arduino IDE. If you know your way around Git, you can clone this repository and get to work. If you’d rather not mess with Git right now, you can download the latest revision of the scaffold in a zip file. Once you have the scaffold, take a look at the README. This will walk you through getting the AVR toolchain setup on your environment and describe some of the different ways to use the scaffold.

The scaffold has a pretty simple structure that I’ll briefly go over here:

  • LICENSE – The license for the scaffold. I’ve chosen to use the MIT license.
  • README.md – The readme file in Markdown. This is the primary source of information regarding the scaffold. It should end up containing all the different pieces one needs to transition from the Arduino IDE to the scaffolding. It also contains links to important pieces of documentation, such as the data sheet and schematic, one will need to work with the Arduino.
  • Rakefile – This informs rake how to build the files in the scaffold.
  • include/ – The directory all include files should be stored in to automatically be discovered by the build system.
  • src/ – The directory all source files should be stored in to automatically be built by the build system.

Take a minute to look at these different files. Try and figure out what each does, then have fun! I’ll be posting more about the scaffolding later.

We will also be adding scaffold generation to Ceedling for Arduino. Ceedling is an open-source framework for unit-testing, mocking, and building robust kick-ass C applications, with special attention paid to crafting embedded system software.

  • Matt Wilbur says:

    I’ve been using rake_builder with some tweaks for cross compiling. This helps manage the header file dependencies. Maybe it’s not so useful if you’re going to use Ceedling, but let me know if you’re interested.

  • Comments are closed.