summaryrefslogtreecommitdiff
path: root/ao-tools
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-12-14 11:47:31 -0800
committerKeith Packard <keithp@keithp.com>2013-12-14 11:47:31 -0800
commit1562affc4951e147eba20380ea5be2e9f7152789 (patch)
tree2fd8a62725a1789c65b26709f453a6124b6c24a8 /ao-tools
parent7d7ae63d8dfcc99a30285e0bd2411901941d1813 (diff)
ao-tools: Use st-flash for STM flashing instead of openocd
st-flash, from the stlink tools, appears more reliable when flashing STM CPUs. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools')
-rw-r--r--ao-tools/ao-flash/ao-flash-stm31
1 files changed, 17 insertions, 14 deletions
diff --git a/ao-tools/ao-flash/ao-flash-stm b/ao-tools/ao-flash/ao-flash-stm
index c5aeb7ae..993258e5 100644
--- a/ao-tools/ao-flash/ao-flash-stm
+++ b/ao-tools/ao-flash/ao-flash-stm
@@ -5,17 +5,20 @@ 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
+
+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 \ No newline at end of file