altos: get stm-bringup building again
[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
9 file=$1
10
11 bin=/tmp/flash$$.bin
12 trap "rm $bin" 0 1 15
13
14 base=`arm-none-eabi-nm $file | awk '/interrupt_vector/ { print $1 }'`
15 case x"$base" in
16 x)
17     echo "$file: No interrupt vector address found"
18     exit 1
19     ;;
20 esac
21
22 arm-none-eabi-objcopy -O binary $file $bin
23
24 st-flash --reset write $bin $base