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