The Arducopter
Arduino.mk makefile is the most useful of the various attempts at producing a standalone command-line environment for Arduino programming.
To use the Arducopter makefile, I set up a directory structure under ~/Documents/Arduino:
+-Arduino
|
+-Arduino.mk
+-config.mk
+-libraries
| +SD
| +RTClib
+-Temperature
|
+ Makefile
+ Temperature.pde
This is the same layout for sketchbooks, sketches and contributed libraries that is used by the official Arduino app, which makes life really easy! In order for the Arducopter makefile to work properly, make sure you at least include the empty "libraries" directory under the sketchbook directory (in my case the sketchbook is "Arduino").
The SD and RTClib folders are libraries I've imported from Adafruit in order to work with their
Adafruit Data Logging Shield.
The content of config.mk at present is:
PORT=/dev/usbmodem*
BOARD = uno
Note that I haven't tried uploading anything to the Arduino yet. The Arducopter makefile does need to be edited for Mac OS X users though. Update the line which uses Spotlight to search for the Arduino.app location:
--- /Users/alex/Desktop/Inbox/Arduino.mk 2011-08-18 11:40:45.000000000 +1000
+++ Arduino.mk 2011-08-18 11:29:38.000000000 +1000
@@ -1,4 +1,6 @@
#
+# Retrieved from
http://code.google.com/p/arducopter/source/browse/trunk/libraries/AP_Common/Arduino.mk+#
# Copyright (c) 2010 Michael Smith. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -98,8 +100,8 @@
#
ifeq ($(SYSTYPE),Darwin)
# use Spotlight to find Arduino.app
- ARDUINO_QUERY = 'kMDItemKind == Application && kMDItemDisplayName == Arduino.app'
- ARDUINOS := $(addsuffix /Contents/Resources/Java,$(shell mdfind -literal $(ARDUINO_QUERY)))
+ ARDUINO_QUERY = 'Arduino.app kind:Application'
+ ARDUINOS := $(addsuffix /Contents/Resources/Java,$(shell mdfind $(ARDUINO_QUERY)))
ifeq ($(ARDUINOS),)
$(error ERROR: Spotlight cannot find Arduino on your system.)
endif
The patch is all there, just select it all and copy/paste. LiveJournal formatting is the pits!
Martin Oldfield's Makefile
Martin Oldfield's
Arduino from the command line writeup doesn't work for me - it works fine to start with until you get external libraries that include C utility files. This causes problems with e.g.: Wire, which includes twi.h and twi.c. Since there is no *.cpp file in that directory, the directory is ignored.
If you get errors like "undefined reference to `vtable for SdFile'", you'll know that you forgot to add "SD/utility" to your ARDUINO_LIBS variable in the Makefile.