chiark / gitweb /
write-firmware
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Aug 2012 19:06:54 +0000 (20:06 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Aug 2012 19:06:54 +0000 (20:06 +0100)
write-firmware [new file with mode: 0755]

diff --git a/write-firmware b/write-firmware
new file mode 100755 (executable)
index 0000000..ff75d4b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+
+usage () { echo 'usage: write-firmware FILE [PORT]'; }
+
+home=/home/reprap/play
+ourfile="$home/Marlin.hex"
+
+infile="$1"
+
+case $# in
+1)   shift; port=/dev/ttyUSB0 ;;
+2)   shift; port="$1"; shift ;;
+*)   usage >&2; exit 1;;
+esac
+
+ad () {
+   avrdude -b 38400 -v -P $port -p atmega644P -c arduino "$@"
+}
+
+cp -v -- "$infile" "$ourfile"
+
+ad "$@"
+ad "$@" -U flash:w:$ourfile