Manually Uploading the Program
In my last article, I presented a program that blinks the built-in LED on my Arduino Due. There's one problem though: I don't like the Arduino software stack.
Now don't get me wrong. I think Arduino is really good at what it sets out to do: Making it easy for beginners to get started. But as a professional software developer, I felt that it was very limiting in some ways. Also, the whole point of this project is to teach myself embedded programming. Using libraries and an IDE that shield me from all the nasty details won't do me much good.
So why did I buy an Arduino board? Fair question. I felt that the Arduino Due is a nice piece of hardware, with its ARM processor and many I/O pins. There's also the whole ecosystem around Arduino, with extension boards for every purpose. Since I'm mostly interested in software and want to keep the soldering to a minimum (at least for now), those extension boards seem like very interesting options for the future.
But back on topic. I'd like to get rid of the Arduino stack, and starting with the upload of the program to the board seems like a good first step. The Arduino IDE uses BOSSA under the hood, so why not use it directly? As a Linux user, I opted to install the BOSSA command-line tools.
First, we need to find out which file we need to upload. You can
configure the Arduino IDE to show verbose output for the build
File -> Preferences). Running a
build with verbose output gives us the name of the last file
that is built. This might be something like
Once we know the path of the file, we can upload it to the
bossac --write --verify --boot -R <insert file here>
No, here's a very important caveat: For this
command to work, the Due needs to be erased before the upload.
The Arduino IDE seems to do that automatically, and maybe one of
these days I too will figure out how to do it. For now, I'm
quite happy to erase the board manually though. This can be done
by pressing the tiny
ERASE button on the board (not
to be confused with the somewhat bigger
If everything went well, you should see something like this:
Device found on ttyACM3 Write 11952 bytes to flash [==============================] 100% (47/47 pages) Verify 11952 bytes of flash [==============================] 100% (47/47 pages) Verify successful Set boot flash true CPU reset.
That's it for this installment. As always, the code is available on GitHub. See you next time!