aboutsummaryrefslogtreecommitdiff
path: root/Arduino/bin/build.sh
diff options
context:
space:
mode:
authorDonald Delmar Davis <don@suspectdevices.com>2017-10-20 10:46:30 -0700
committerDonald Delmar Davis <don@suspectdevices.com>2017-10-20 10:46:30 -0700
commit261ac02efc8361ac1e55d9be72cfab1c8ea55237 (patch)
tree4fbe0b23659cbd7c5f50c9e10f65d0441e6fee7c /Arduino/bin/build.sh
Let's do this
Diffstat (limited to 'Arduino/bin/build.sh')
-rwxr-xr-xArduino/bin/build.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/Arduino/bin/build.sh b/Arduino/bin/build.sh
new file mode 100755
index 0000000..fecf63a
--- /dev/null
+++ b/Arduino/bin/build.sh
@@ -0,0 +1,36 @@
+# build.sh - build the ems arduino code and flash it
+
+# Project Variables
+INO_NAME=ems
+PROJECT_PATH=/home/pi/ems/Arduino
+
+# Local System variables
+PORT=ttyACM0
+ARDUINO_PATH=/home/pi/arduino-1.6.12
+PACKAGES_PATH=/home/pi/.arduino15/packages
+
+# Arduino compile tools are here:
+TOOL_PATH=$PACKAGES_PATH/arduino/tools
+HARDWARE_PATH=$PACKAGES_PATH/arduino/hardware
+TOOLS="-tools $ARDUINO_PATH/tools-builder -tools $ARDUINO_PATH/hardware/tools/avr -tools $PACKAGES_PATH"
+HARDWARE="-hardware $HARDWARE_PATH -hardware $PACKAGES_PATH"
+BUILD_PATH=$PROJECT_PATH/build
+CMSIS_PATH=$PACKAGES_PATH/arduino/tools/CMSIS/4.0.0-atmel
+GCC_PATH=$PACKAGES_PATH/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1
+BOSSAC_PATH=$PACKAGES_PATH/arduino/tools/bossac/1.7.0
+OPENOCD_PATH=$PACKAGES_PATH/arduino/tools/openocd/0.9.0-arduino
+SOURCE_PATH=$PROJECT_PATH/
+
+ARDUINO=/home/pi/arduino-1.6.12/arduino-builder
+TOOLS_BUILDER=/home/pi/arduino-1.6.12/tools-builder
+
+# make sure our build folder exists
+mkdir -p $BUILD_PATH
+
+# compile and install
+$ARDUINO -dump-prefs -logger=machine $HARDWARE $TOOLS -built-in-libraries $ARDUINO_PATH/libraries -libraries $PROJECT_PATH/libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10612 -build-path $BUILD_PATH -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.CMSIS.path=$CMSIS_PATH -prefs=runtime.tools.arm-none-eabi-gcc.path=$GCC_PATH -prefs=runtime.tools.bossac.path=$BOSSAC_PATH -prefs=runtime.tools.openocd.path=$OPENOCD_PATH -verbose $PROJECT_PATH/$INO_NAME/$INO_NAME.ino
+$ARDUINO -compile -logger=machine $HARDWARE $TOOLS -built-in-libraries $ARDUINO_PATH/libraries -libraries $PROJECT_PATH/libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10612 -build-path $BUILD_PATH -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.CMSIS.path=$CMSIS_PATH -prefs=runtime.tools.arm-none-eabi-gcc.path=$GCC_PATH -prefs=runtime.tools.bossac.path=$BOSSAC_PATH -prefs=runtime.tools.openocd.path=$OPENOCD_PATH -verbose $PROJECT_PATH/$INO_NAME/$INO_NAME.ino
+
+# load to the feather if possible
+$BOSSAC_PATH/bossac -i -d --port=$PORT -U true -i -e -w -v $BUILD_PATH/$INO_NAME.ino.bin -R
+