From f0c187dd6479996b83f85b6decf303ec0fc70fe5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 6 Jan 2017 09:10:23 -0800 Subject: ao-tools/ao-usbload: Pad image with 0xff instead of random bits Clear the temporary block to 0xff before copying in the target data so that any unused bytes end up being left at 0xff instead of inheriting whatever data was in the block before. Signed-off-by: Keith Packard --- ao-tools/lib/ao-selfload.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ao-tools') diff --git a/ao-tools/lib/ao-selfload.c b/ao-tools/lib/ao-selfload.c index 0a23dfda..754cd784 100644 --- a/ao-tools/lib/ao-selfload.c +++ b/ao-tools/lib/ao-selfload.c @@ -110,6 +110,7 @@ ao_self_write(struct cc_usb *cc, struct ao_hex_image *image) start = image->address; if (stop > image->address + image->length) stop = image->address + image->length; + memset(block, 0xff, 0x100); memcpy(block + start - address, image->data + start - image->address, stop - start); ao_self_block_write(cc, address, block); ao_self_block_read(cc, address, check); -- cgit v1.2.3 From f004eaa2c26b4c61a8c3de2c0667a4e9865e704d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Mar 2017 13:37:12 -0800 Subject: ao-tools/ao-flash-lpc: Adapt to current openocd LPC support Openocd 0.9.0 has generalized the lpc11xx support for all lpc11xx processors, not just the lpc11u14. This replaces the specific lpc11u14.cfg with the general lpc11xx.cfg file. Unlike the build we were using, this doesn't adjust the 'verify' command to adapt for the checksum which gets added during the flashing process. Hence, we disable verification and trust that if the flash loader works to load the OS, it's fine. Signed-off-by: Keith Packard --- ao-tools/ao-flash/ao-flash-lpc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ao-tools') diff --git a/ao-tools/ao-flash/ao-flash-lpc b/ao-tools/ao-flash/ao-flash-lpc index 7ac5b523..9e1d1cdb 100755 --- a/ao-tools/ao-flash/ao-flash-lpc +++ b/ao-tools/ao-flash/ao-flash-lpc @@ -8,9 +8,9 @@ esac cmds=/tmp/flash$$ trap "rm $cmds" 0 1 15 file="$1" -echo "program $file verify reset" > $cmds +echo "program $file reset" > $cmds openocd \ -f interface/stlink-v2.cfg \ - -f target/lpc11u14.cfg \ + -f target/lpc11xx.cfg \ -f $cmds \ -c shutdown -- cgit v1.2.3 From 7bb4dbab45f98dd5fd85d9daf12d27b153c0ef3a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 5 Mar 2017 22:33:36 -0800 Subject: ao-tools/ao-flash-stm: Use openocd instead of st-utils openocd upstream and debian package can both flash stm32l processors, so use that in preference to st-flash. Signed-off-by: Keith Packard --- ao-tools/ao-flash/ao-flash-stm | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'ao-tools') diff --git a/ao-tools/ao-flash/ao-flash-stm b/ao-tools/ao-flash/ao-flash-stm index 9eebf5d2..a20428f2 100755 --- a/ao-tools/ao-flash/ao-flash-stm +++ b/ao-tools/ao-flash/ao-flash-stm @@ -5,29 +5,12 @@ case "$#" in exit 1 ;; esac - -ST_FLASH=st-flash - -if which $ST_FLASH > /dev/null; then - : -else - echo "$0: $ST_FLASH not found. Check to see if the stlink package is installed" - exit 1 -fi - -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 +cmds=/tmp/flash$$ +trap "rm $cmds" 0 1 15 +file="$1" +echo "program $file reset" > $cmds +openocd \ + -f interface/stlink-v2.cfg \ + -f target/stm32l1.cfg \ + -f $cmds \ + -c shutdown -- cgit v1.2.3 From 04d4b17635fc9395c70aa0840971c00082f509ba Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 9 Apr 2017 12:48:54 -0700 Subject: ao-elftohex: Add conditions for skipping ELF sections Skip sections with size 0, or which are of type SHT_NOBITS or which don't have the SHF_ALLOC flag set. This avoids crashing on sections which don't have any data to copy. Signed-off-by: Keith Packard --- ao-tools/ao-elftohex/ao-elftohex.c | 1 + ao-tools/lib/ao-elf.c | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'ao-tools') diff --git a/ao-tools/ao-elftohex/ao-elftohex.c b/ao-tools/ao-elftohex/ao-elftohex.c index 265908c5..f3ab0c38 100644 --- a/ao-tools/ao-elftohex/ao-elftohex.c +++ b/ao-tools/ao-elftohex/ao-elftohex.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "ao-hex.h" #include "ao-elf.h" #include "ao-verbose.h" diff --git a/ao-tools/lib/ao-elf.c b/ao-tools/lib/ao-elf.c index c44102f8..cc127b62 100644 --- a/ao-tools/lib/ao-elf.c +++ b/ao-tools/lib/ao-elf.c @@ -186,6 +186,7 @@ load_write(struct ao_hex_image *from, uint32_t address, uint32_t length, void *d return new; } +#define DBG 0 /* * Construct a large in-memory block for all * of the loaded sections of the program @@ -202,7 +203,7 @@ get_load(Elf *e) GElf_Phdr phdr; GElf_Addr sh_paddr; struct ao_hex_image *load = NULL; -#if 0 +#if DBG char *section_name; #endif size_t nshdr; @@ -231,7 +232,7 @@ get_load(Elf *e) /* Get the associated file section */ -#if 0 +#if DBG fprintf (stderr, "offset %08x vaddr %08x paddr %08x filesz %08x memsz %08x\n", (uint32_t) phdr.p_offset, (uint32_t) phdr.p_vaddr, @@ -252,18 +253,16 @@ get_load(Elf *e) abort(); } -#if 0 +#if DBG section_name = elf_strptr(e, shstrndx, shdr.sh_name); #endif - if (phdr.p_offset <= shdr.sh_offset && shdr.sh_offset < phdr.p_offset + phdr.p_filesz) { - - if (shdr.sh_size == 0) - continue; - + if (shdr.sh_size != 0 && shdr.sh_type != SHT_NOBITS && (shdr.sh_flags & SHF_ALLOC) && + phdr.p_offset <= shdr.sh_offset && shdr.sh_offset < phdr.p_offset + phdr.p_filesz) + { sh_paddr = phdr.p_paddr + shdr.sh_offset - phdr.p_offset; -#if 0 +#if DBG fprintf (stderr, "\tsize %08x rom %08x exec %08x %s\n", (uint32_t) shdr.sh_size, (uint32_t) sh_paddr, -- cgit v1.2.3 From ec319edd2cda321d7542784b997acd0da040fa3d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 21 Apr 2017 09:17:18 -0700 Subject: ao-test-baro: Be more lax about altitude checks High pressure here today and the altimeter is reading -69m. Allow down to -100m when testing baro values. Signed-off-by: Keith Packard --- ao-tools/ao-test-baro/ao-test-baro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ao-tools') diff --git a/ao-tools/ao-test-baro/ao-test-baro.c b/ao-tools/ao-test-baro/ao-test-baro.c index d2b81e4f..36c805c2 100644 --- a/ao-tools/ao-test-baro/ao-test-baro.c +++ b/ao-tools/ao-test-baro/ao-test-baro.c @@ -164,7 +164,7 @@ do_baro(struct cc_usb *usb) { double temperature = strtod(temp[2], NULL) / 100.0; double altitude = strtod(alt[1], NULL); - if (altitude < -50 || 3000 < altitude) { + if (altitude < -100 || 3000 < altitude) { printf ("weird altitude %f\n", altitude); free_baro(b); return 0; -- cgit v1.2.3