Arduino Part 2

In embedded software, testing on January 31, 2011 at 2:22 am

Processing Not C

Upon first look, I thought that the Arduino IDE supported C and C++. It actually looks like it. But after reading the first couple of chapters of Getting Started With Arduino, I learned that it actually supports a variant of the Processing language. This is nice for getting started quickly; unfortunately, it does not necessarily allow the incorporation of testing frameworks like Unity and CppUnit. So my next task is to get Eclipse configured for the Arduino. The starting point for this exploration is in the Arduino playground pages on Eclipse. It seems like the instructions are quite straight forward.

The way the Arduino IDE works is that it translates the source to C and then passes it to gcc. I may be able to integrate one of the unit testing harnesses with this, but not for the initial class since the first group is a set of developers who are programming in C and C++. One of the requirements of the class is that we use these languages as much as possible. I will, however, try to introduce domain specific languages for testing as part of the course content.

Starting with Eclipse

I might as well jump right it. I’ve already got Eclipse set up for the AVR processors on my Mac. This required first installing the CrossPack tool chain. This installs the AVR gcc compiler and other AVR development tools. There are other tools required for Windows and Linux. These are identified in the Arduino playground.

After a couple of hours of reading and hacking, I have a blink program written using Eclipse and running on the Arduino. Here’s what I ended up doing. Most of the information comes from the Arduino playground – Eclipse page already mentioned. The specific things I did were:

  1. Compiled my own static library for the diecimilia board. I called this libDiecimiliaCore.a. I’ll have to compile another one for the Uno.
  2. Created my first project for the Arduino. It references the header files in the library project and includes the static library when linking.
  3. Copied the main.cxx to the project and renamed it main.c since this is simple C code.
  4. Wrote the “blink” application from the Arduino IDE. I simply copied it. Now, the interesting thing is that the delay is over an order of magnitude faster than with the Arduino IDE. I think one of the tasks for the class will be to calibrate the delay loop. This is a good test to start with.

The instructions for doing this are quite clear. It is fairly tedious and time consuming to get this workiong the first time. Next up is making a template / configuration so I don’t have to go through all of the settings every time. At least I’m seeing some progress.

  1. […] learned a bit more about the Arduino in the last couple of weeks, since my last Arduino post. Most of the information has been about using Eclipse and the Arduino Uno. The basic project I […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: