Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
micropython/ports/stm32/autoflash
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
44 lines (39 sloc)
859 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script loops doing the following: | |
# - wait for DFU device | |
# - flash DFU device | |
# - wait for DFU to exit | |
# - wait for serial port to appear | |
# - run a terminal | |
SERIAL=/dev/ttyACM0 | |
DEVICE=0483:df11 | |
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 $DEVICE -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 | |
echo "waiting for $SERIAL..." | |
while true; do | |
if ls /dev/tty* | grep -q $SERIAL; then | |
break | |
fi | |
sleep 1s | |
continue | |
done | |
sleep 1s | |
picocom $SERIAL | |
done |