ao-tools: Add ao-flash-stm and ao-flash-lpc scripts
authorKeith Packard <keithp@keithp.com>
Sun, 8 Dec 2013 07:27:30 +0000 (23:27 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 8 Dec 2013 07:27:30 +0000 (23:27 -0800)
These use openocd to download boot loaders to the arm-based products

Signed-off-by: Keith Packard <keithp@keithp.com>
Makefile.am
ao-tools/Makefile.am
ao-tools/ao-flash/Makefile.am [new file with mode: 0644]
ao-tools/ao-flash/ao-flash-lpc [new file with mode: 0644]
ao-tools/ao-flash/ao-flash-stm [new file with mode: 0644]
ao-tools/ao-stmload/ao-stmload.c
ao-tools/ao-usbload/ao-usbload.c
configure.ac

index bd7772e..fa4da1f 100644 (file)
@@ -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
 
index 9c38273..02d6c22 100644 (file)
@@ -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 (file)
index 0000000..97dc91c
--- /dev/null
@@ -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 (file)
index 0000000..57f632b
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+case "$#" in
+0)
+       echo "usage: $0 <filename> ..."
+       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 (file)
index 0000000..c5aeb7a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+case "$#" in
+0)
+       echo "usage: $0 <filename> ..."
+       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
index 618ace2..b6b4abc 100644 (file)
@@ -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
         */
index 9e32b2b..860eb8a 100644 (file)
@@ -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;
index dea7139..a2a2206 100644 (file)
@@ -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
 ])