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 bd7772e832cb8a8df89560863126beeacf6340c7..fa4da1fe65939473c1f2c9fe54b294d11a4180dc 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
 
 
 EXTRA_DIST = ChangeLog
 
index 9c38273955236d36a1f2a4f260c2254d8f0762e0..02d6c227e2a9835cf9f5fe3831a95c7583e22490 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 \
 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 618ace21c7d91c03d7b3363be1b040314deae46c..b6b4abc63720c2be99a518d21f9913ad81a317e2 100644 (file)
@@ -242,8 +242,10 @@ main (int argc, char **argv)
        } else
                usage(argv[0]);
 
        } 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");
                fprintf(stderr, "Cannot find required symbols\n");
+               usage(argv[0]);
+       }
 
        /* Connect to the programming dongle
         */
 
        /* Connect to the programming dongle
         */
index 9e32b2b9ee10fa779dd85e8a34d7f29c251a2dce..860eb8a5d4778a47f3defdb6d397941bea9c4bed 100644 (file)
@@ -184,8 +184,10 @@ main (int argc, char **argv)
        } else
                usage(argv[0]);
 
        } 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");
                fprintf(stderr, "Cannot find required symbols\n");
+               usage(argv[0]);
+       }
 
        {
                int     is_loader;
 
        {
                int     is_loader;
index dea71396539971e5f029353c44c145eb311b6d58..a2a22063d3e78db216a7cc0f0e7d051a7d34e9a7 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-dump-up/Makefile
 ao-tools/ao-elftohex/Makefile
 ao-tools/ao-usbload/Makefile
+ao-tools/ao-flash/Makefile
 ao-utils/Makefile
 src/Version
 ])
 ao-utils/Makefile
 src/Version
 ])