ao-tools: Add ao-flash-samd21 script
[fw/altos] / ao-tools / ao-flash / ao-flash-samd21
diff --git a/ao-tools/ao-flash/ao-flash-samd21 b/ao-tools/ao-flash/ao-flash-samd21
new file mode 100755 (executable)
index 0000000..1b3dc87
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+case "$#" in
+1)
+    ;;
+*)
+    echo "usage: $0 <filename> ..."
+    exit 1
+    ;;
+esac
+
+openocd \
+    -f interface/stlink.cfg \
+    -c 'transport select hla_swd' \
+    -c 'set CPUTAPID 0x0bc11477' \
+    -f target/at91samdXX.cfg \
+    -c 'adapter speed 10' \
+    -c init \
+    -c 'reset init' \
+    -c 'at91samd bootloader 0' \
+    -c 'reset init' \
+    -c "program $1" \
+    -c "shutdown"