summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-17 13:04:51 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-17 13:04:51 +0000
commit8a9a31e57b48f948dd8c0cf23a91e08848af2462 (patch)
tree08fa171212a436410844ee543589b71ec4ae2716
parentfb431bf556d26ec298f223963c6f1be9a00a5cb7 (diff)
downloadmicropython-8a9a31e57b48f948dd8c0cf23a91e08848af2462.tar.gz
micropython-8a9a31e57b48f948dd8c0cf23a91e08848af2462.zip
stmhal: Add autoflash script, to flash a DFU device automatically.
-rwxr-xr-xstmhal/autoflash24
1 files changed, 24 insertions, 0 deletions
diff --git a/stmhal/autoflash b/stmhal/autoflash
new file mode 100755
index 0000000000..0f4bfd0394
--- /dev/null
+++ b/stmhal/autoflash
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# this script waits for a DFU device to be attached and then flashes it
+# it then waits until the DFU mode is exited, and then loops
+
+while true; do
+ echo "waiting for DFU device..."
+ while true; do
+ if lsusb | grep -q DFU; then
+ break
+ fi
+ sleep 1s
+ done
+ echo "found DFU device, flashing"
+ dfu-util -a 0 -D build/flash.dfu
+ echo "waiting for DFU to exit..."
+ while true; do
+ if lsusb | grep -q DFU; then
+ sleep 1s
+ continue
+ fi
+ break
+ done
+done