c5aeb7ae0a67501a675cd51f2f6a06a398d00c4e
[fw/altos] / ao-tools / ao-flash / ao-flash-stm
1 #!/bin/sh
2 case "$#" in
3 0)
4         echo "usage: $0 <filename> ..."
5         exit 1
6         ;;
7 esac
8 cmds=/tmp/flash$$
9 trap "rm $cmds" 0 1 15
10 for file in "$@"; do
11         echo "flash write_image $file"
12 done > $cmds
13 openocd \
14         -f interface/stlink-v2.cfg \
15         -f target/stm32lx_stlink.cfg \
16         -c init \
17         -c 'reset halt' \
18         -f $cmds \
19         -c 'reset init' \
20         -c 'reset run' \
21         -c shutdown