summaryrefslogtreecommitdiff
path: root/ao-tools/ao-flash/ao-flash-stm
blob: 993258e5f0be2a9b37b9db1dceabcac768a17e0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
case "$#" in
0)
	echo "usage: $0 <filename> ..."
	exit 1
	;;
esac

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