diff options
author | Keith Packard <keithp@keithp.com> | 2017-03-05 22:33:36 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-03-05 22:33:36 -0800 |
commit | 7bb4dbab45f98dd5fd85d9daf12d27b153c0ef3a (patch) | |
tree | 1630eb43ff2254f740867d8346558c7ab5362894 | |
parent | f004eaa2c26b4c61a8c3de2c0667a4e9865e704d (diff) |
ao-tools/ao-flash-stm: Use openocd instead of st-utils
openocd upstream and debian package can both flash stm32l processors,
so use that in preference to st-flash.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rwxr-xr-x | ao-tools/ao-flash/ao-flash-stm | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/ao-tools/ao-flash/ao-flash-stm b/ao-tools/ao-flash/ao-flash-stm index 9eebf5d2..a20428f2 100755 --- a/ao-tools/ao-flash/ao-flash-stm +++ b/ao-tools/ao-flash/ao-flash-stm @@ -5,29 +5,12 @@ case "$#" in exit 1 ;; esac - -ST_FLASH=st-flash - -if which $ST_FLASH > /dev/null; then - : -else - echo "$0: $ST_FLASH not found. Check to see if the stlink package is installed" - exit 1 -fi - -file=$1 - -bin=/tmp/flash$$.bin -trap "rm $bin" 0 1 15 - -base=`arm-none-eabi-nm $file | awk '/interrupt_vector/ { print $1 }'` -case x"$base" in -x) - echo "$file: No interrupt vector address found" - exit 1 - ;; -esac - -arm-none-eabi-objcopy -O binary $file $bin - -$ST_FLASH --reset write $bin $base +cmds=/tmp/flash$$ +trap "rm $cmds" 0 1 15 +file="$1" +echo "program $file reset" > $cmds +openocd \ + -f interface/stlink-v2.cfg \ + -f target/stm32l1.cfg \ + -f $cmds \ + -c shutdown |