Now that I have the Arduino up and running, I knew I wanted to use my editor of choice and command line build tools.
There is of course the alternative of using the Arduino IDE as a command line tool, but it still felt too clunky for my needs.
Secondly, there is the Arduino Makefile project, which would be a better fit, was it not… you know… make. And I saw a few results for CMake when googling, don’t get me started.
$ brew tap osx-cross/avr$ brew install avr-libc avr-gdb$ brew install avrdude --with-usb
After that, I looked at the verbose output from the Arduino IDE to figure out most settings. And I also compared them to other packages (Arduino-make etc).
In the end, I got this build.sh
To communicate with the Arduino (e.g. displaying the debug output), I use “screen” on osx (On windows there’s PuTTY).
You quit “screen” with ^A+K:
$ screen /dev/cu.wchusbserial1410 9600
I compared the turnaround time between my script and Arduino-make:
$ time ./build.shreal 0m3.264suser 0m0.185ssys 0m0.100s
$ time (make -f ../Makefile && make -f ../Makefile verify_size reset do_upload)real 0m6.275suser 0m1.224ssys 0m1.120s
That’s 3 seconds longer. That’s going to get annoying real fast! Of course you get a ton of extra features, but I just don’t need them.