This packages supplies utilities and helper wrappers around the Arduino-Makefile package. The following makefile commands are implemented.
-
make (or just make all): Compiles the sketch given by ARD_MK_UTILS_SKETCH_DIR env variable which must be set by the user (or more typically, automatically set by the sketch Makefile; see Examples section). Dependencies are downloaded and installed (see the Dependencies section).
-
make clean: Deletes the files created by get-dependencies.sh.
-
Checks out sudar/Arduino-Makefile into a subdirectory.
-
Updates any required system dependencies via sudo apt-get etc.
-
Updates the env.sh file for any environment needed by Arduino-Makefile (e.g., ARDUINO_DIR) or any other environment required by the Arduino software itself.
Examples are under the examples subdirectory. The examples show a sketch Makefile that works just like the Arduino-Makefile sketch Makefiles (is a child Makefile), but of course with the addition of dependency management via including a arduino-mk-utils-bootstrap.mk helper file. You may or may not have to set certain variables required by Arduino-Makefile such as MONITOR_PORT (see the Finding the MONITOR_PORT section below for details).
To compile, upload, and run a blink sketch (set ARD_MK_UTILS_DIR to the directory where you downloaded this package into):
cd examples/Blink
ARD_MK_UTILS_DIR=$HOME/bgoodr/arduino-mk-utils make
ARD_MK_UTILS_DIR=$HOME/bgoodr/arduino-mk-utils make upload
If you have some local Python installed into your PATH that doesn't have the "serial" module, you can set the path to the system-installed Python via:
PATH=/usr/bin:$PATH ARD_MK_UTILS_DIR=$HOME/bgoodr/arduino-mk-utils make upload
For instance, on Ubuntu or Debian Linux, commonly MONITOR_PORT turns
out to be /dev/ttyACM0. When the upload
rule is executed, this
package attempts to determine the MONITOR_PORT by using the underlying
Arduino-Makefile/Arduino.mk help
rule to identify it (processing
done inside
fix-monitor-port-permissions.sh). The
USB cable has to be plugged in for this to work.
On Linux, you can also determine this device path via the following procedure:
-
Before connecting the arduino USB cable to the computer execute: find /dev/ >/tmp/dev.1
-
Connect the USB cable and then execute : find /dev/ >/tmp/dev.2
-
Then execute: diff -u /tmp/dev.1 /tmp/dev.2 | grep -e '+/dev/tty'
-
You will then see something like:
+/dev/ttyACM0
-
The /dev/ttyACM0 line in the diff output is the value to set to MONITOR_PORT.