Arduino on the command line

I’ve lately been trying to compile Arduino projects from command line. Primarily
because the Arduino IDE wasn’t working out of the box on 64-bit Ubuntu (9.04). That problem
was eventually solved,
but I’ve been meaning to move away from that IDE anyway.

After reading a lot of posts I finally ended up with a working solution.

In addition to arduino (for 32-bit linux),
you need to get a couple of packages:

You’ll find hardware/cores/arduino/Makefile under the Arduino folder. This one is meant to
serve as a basis for your own projects. I had to make some modifications to it, in addition to what
was described in the file. You can get my Makefile, which
basically just splits the $AVT_TOOLS_PATH into two separate paths.

A key point that was hard to figure out, was that the Arduino needs to be reset right before
a program is uploaded. This is automatically done by the IDE, but not by the Makefile. If this
is not in place, you’ll get error messages like: