X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-flash%2Fao-flash-stm;h=9eebf5d2e55eb0dde1312d95cf53c8c95a669db5;hp=c5aeb7ae0a67501a675cd51f2f6a06a398d00c4e;hb=f004eaa2c26b4c61a8c3de2c0667a4e9865e704d;hpb=5fd0dc6f69e7614ba71bbc215b32260a11595af3 diff --git a/ao-tools/ao-flash/ao-flash-stm b/ao-tools/ao-flash/ao-flash-stm old mode 100644 new mode 100755 index c5aeb7ae..9eebf5d2 --- a/ao-tools/ao-flash/ao-flash-stm +++ b/ao-tools/ao-flash/ao-flash-stm @@ -5,17 +5,29 @@ case "$#" in 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/stm32lx_stlink.cfg \ - -c init \ - -c 'reset halt' \ - -f $cmds \ - -c 'reset init' \ - -c 'reset run' \ - -c shutdown + +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