Skip to content

Commit e20b6b4

Browse files
committed
stmhal: autoflash now enters serial comms after flashing.
1 parent 09a4d83 commit e20b6b4

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

stmhal/autoflash

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/sh
22
#
3-
# this script waits for a DFU device to be attached and then flashes it
4-
# it then waits until the DFU mode is exited, and then loops
3+
# This script loops doing the following:
4+
# - wait for DFU device
5+
# - flash DFU device
6+
# - wait for DFU to exit
7+
# - wait for serial port to appear
8+
# - run a terminal
9+
10+
SERIAL=/dev/ttyACM0
511

612
while true; do
713
echo "waiting for DFU device..."
@@ -11,8 +17,10 @@ while true; do
1117
fi
1218
sleep 1s
1319
done
20+
1421
echo "found DFU device, flashing"
1522
dfu-util -a 0 -D build/flash.dfu
23+
1624
echo "waiting for DFU to exit..."
1725
while true; do
1826
if lsusb | grep -q DFU; then
@@ -21,4 +29,15 @@ while true; do
2129
fi
2230
break
2331
done
32+
33+
echo "waiting for $SERIAL..."
34+
while true; do
35+
if ls /dev/tty* | grep -q $SERIAL; then
36+
break
37+
fi
38+
sleep 1s
39+
continue
40+
done
41+
sleep 1s
42+
picocom $SERIAL
2443
done

0 commit comments

Comments
 (0)