From: Keith Packard Date: Sun, 8 Dec 2013 07:27:30 +0000 (-0800) Subject: ao-tools: Add ao-flash-stm and ao-flash-lpc scripts X-Git-Tag: 1.3~74 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=5fd0dc6f69e7614ba71bbc215b32260a11595af3;hp=eee9b3ce1e5adae5aa4566050b6d6048344e92c4 ao-tools: Add ao-flash-stm and ao-flash-lpc scripts These use openocd to download boot loaders to the arm-based products Signed-off-by: Keith Packard --- diff --git a/Makefile.am b/Makefile.am index bd7772e8..fa4da1fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=src doc altoslib libaltos altosuilib altosui micropeak ao-tools ao-utils altosdroid +SUBDIRS=ao-tools src doc altoslib libaltos altosuilib altosui micropeak ao-utils altosdroid EXTRA_DIST = ChangeLog diff --git a/ao-tools/Makefile.am b/ao-tools/Makefile.am index 9c382739..02d6c227 100644 --- a/ao-tools/Makefile.am +++ b/ao-tools/Makefile.am @@ -1,3 +1,4 @@ SUBDIRS=lib ao-rawload ao-dbg ao-bitbang ao-eeprom ao-list \ ao-load ao-telem ao-stmload ao-send-telem ao-sky-flash \ - ao-dumpflash ao-edit-telem ao-dump-up ao-elftohex + ao-dumpflash ao-edit-telem ao-dump-up ao-elftohex \ + ao-flash diff --git a/ao-tools/ao-flash/Makefile.am b/ao-tools/ao-flash/Makefile.am new file mode 100644 index 00000000..97dc91cd --- /dev/null +++ b/ao-tools/ao-flash/Makefile.am @@ -0,0 +1 @@ +bin_SCRIPTS=ao-flash-stm ao-flash-lpc \ No newline at end of file diff --git a/ao-tools/ao-flash/ao-flash-lpc b/ao-tools/ao-flash/ao-flash-lpc new file mode 100644 index 00000000..57f632b4 --- /dev/null +++ b/ao-tools/ao-flash/ao-flash-lpc @@ -0,0 +1,21 @@ +#!/bin/sh +case "$#" in +0) + echo "usage: $0 ..." + 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/lpc11u14.cfg \ + -c init \ + -c 'reset halt' \ + -f $cmds \ + -c 'reset init' \ + -c 'reset run' \ + -c shutdown diff --git a/ao-tools/ao-flash/ao-flash-stm b/ao-tools/ao-flash/ao-flash-stm new file mode 100644 index 00000000..c5aeb7ae --- /dev/null +++ b/ao-tools/ao-flash/ao-flash-stm @@ -0,0 +1,21 @@ +#!/bin/sh +case "$#" in +0) + echo "usage: $0 ..." + 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 diff --git a/ao-tools/ao-stmload/ao-stmload.c b/ao-tools/ao-stmload/ao-stmload.c index 618ace21..b6b4abc6 100644 --- a/ao-tools/ao-stmload/ao-stmload.c +++ b/ao-tools/ao-stmload/ao-stmload.c @@ -242,8 +242,10 @@ main (int argc, char **argv) } else usage(argv[0]); - if (ao_editaltos_find_symbols(file_symbols, num_file_symbols, ao_symbols, ao_num_symbols)) + if (!ao_editaltos_find_symbols(file_symbols, num_file_symbols, ao_symbols, ao_num_symbols)) { fprintf(stderr, "Cannot find required symbols\n"); + usage(argv[0]); + } /* Connect to the programming dongle */ diff --git a/ao-tools/ao-usbload/ao-usbload.c b/ao-tools/ao-usbload/ao-usbload.c index 9e32b2b9..860eb8a5 100644 --- a/ao-tools/ao-usbload/ao-usbload.c +++ b/ao-tools/ao-usbload/ao-usbload.c @@ -184,8 +184,10 @@ main (int argc, char **argv) } else usage(argv[0]); - if (ao_editaltos_find_symbols(file_symbols, num_file_symbols, ao_symbols, ao_num_symbols)) + if (!ao_editaltos_find_symbols(file_symbols, num_file_symbols, ao_symbols, ao_num_symbols)) { fprintf(stderr, "Cannot find required symbols\n"); + usage(argv[0]); + } { int is_loader; diff --git a/configure.ac b/configure.ac index dea71396..a2a22063 100644 --- a/configure.ac +++ b/configure.ac @@ -408,6 +408,7 @@ ao-tools/ao-edit-telem/Makefile ao-tools/ao-dump-up/Makefile ao-tools/ao-elftohex/Makefile ao-tools/ao-usbload/Makefile +ao-tools/ao-flash/Makefile ao-utils/Makefile src/Version ])