diff options
author | Keith Packard <keithp@keithp.com> | 2014-07-15 22:55:20 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-07-15 22:55:20 -0700 |
commit | 3cf030fffffd223c3717011e03aac82346295d71 (patch) | |
tree | b6da4fbb1180b75bedb86ce608503a6c0aeb47f3 /src/product | |
parent | 607fbb01710be1cb263625337f5be3d0fb48d5e7 (diff) | |
parent | 9ab3a1de95b705783c31a7e16447f52c10b6b480 (diff) |
Merge tag '1.4' into fox
tagging 1.4 release
Conflicts:
src/Makefile
Diffstat (limited to 'src/product')
-rw-r--r-- | src/product/Makefile.teledongle | 4 | ||||
-rw-r--r-- | src/product/Makefile.telelaunch | 4 | ||||
-rw-r--r-- | src/product/Makefile.telemetrum | 4 | ||||
-rw-r--r-- | src/product/Makefile.telemini | 4 | ||||
-rw-r--r-- | src/product/Makefile.telenano | 4 | ||||
-rw-r--r-- | src/product/ao_flash_task.c | 39 | ||||
-rw-r--r-- | src/product/ao_micropeak.h | 2 |
7 files changed, 47 insertions, 14 deletions
diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle index da9bcba0..81151364 100644 --- a/src/product/Makefile.teledongle +++ b/src/product/Makefile.teledongle @@ -7,8 +7,8 @@ # TD_VER, TD_DEF and include # this file -vpath %.c ..:../core:../cc1111:../drivers:../product -vpath %.h ..:../core:../cc1111:../drivers:../product +vpath %.c ..:../kernel:../cc1111:../drivers:../product +vpath %.h ..:../kernel:../cc1111:../drivers:../product vpath ao-make-product.5c ../util ifndef VERSION diff --git a/src/product/Makefile.telelaunch b/src/product/Makefile.telelaunch index a5e2eb7f..90fe7833 100644 --- a/src/product/Makefile.telelaunch +++ b/src/product/Makefile.telelaunch @@ -4,8 +4,8 @@ # define TELELAUNCH_VER, TELELAUNCH_DEF # this file -vpath %.c ..:../core:../cc1111:../drivers:../product -vpath %.h ..:../core:../cc1111:../drivers:../product +vpath %.c ..:../kernel:../cc1111:../drivers:../product +vpath %.h ..:../kernel:../cc1111:../drivers:../product vpath ao-make-product.5c ../util ifndef VERSION diff --git a/src/product/Makefile.telemetrum b/src/product/Makefile.telemetrum index c740a483..dbbf57d8 100644 --- a/src/product/Makefile.telemetrum +++ b/src/product/Makefile.telemetrum @@ -7,8 +7,8 @@ # TM_VER, TM_DEF, TM_INC and TM_SRC and include # this file -vpath %.c .:..:../core:../cc1111:../drivers:../product -vpath %.h .:..:../core:../cc1111:../drivers:../product +vpath %.c .:..:../kernel:../cc1111:../drivers:../product +vpath %.h .:..:../kernel:../cc1111:../drivers:../product vpath ao-make-product.5c ../util ifndef VERSION diff --git a/src/product/Makefile.telemini b/src/product/Makefile.telemini index 0884079e..ff8b9d56 100644 --- a/src/product/Makefile.telemini +++ b/src/product/Makefile.telemini @@ -4,8 +4,8 @@ # Define TELEMINI_VER and TELEMINI_DEF and then # include this file -vpath %.c ..:../core:../cc1111:../drivers:../product -vpath %.h ..:../core:../cc1111:../drivers:../product +vpath %.c ..:../kernel:../cc1111:../drivers:../product +vpath %.h ..:../kernel:../cc1111:../drivers:../product vpath ao-make-product.5c ../util ifndef VERSION diff --git a/src/product/Makefile.telenano b/src/product/Makefile.telenano index c31989ee..d2fcb6d8 100644 --- a/src/product/Makefile.telenano +++ b/src/product/Makefile.telenano @@ -4,8 +4,8 @@ # Define TELENANO_VER and TELENANO_DEF and then # include this file -vpath %.c ..:../core:../cc1111:../drivers:../product -vpath %.h ..:../core:../cc1111:../drivers:../product +vpath %.c ..:../kernel:../cc1111:../drivers:../product +vpath %.h ..:../kernel:../cc1111:../drivers:../product vpath ao-make-product.5c ../util ifndef VERSION diff --git a/src/product/ao_flash_task.c b/src/product/ao_flash_task.c index 6cb308e1..9a12add6 100644 --- a/src/product/ao_flash_task.c +++ b/src/product/ao_flash_task.c @@ -79,6 +79,14 @@ ao_block_erase(void) ao_flash_erase_page(p); } +static int +ao_block_valid_address(uint32_t addr) +{ + if ((uint32_t) AO_BOOT_APPLICATION_BASE <= addr && addr <= (uint32_t) AO_BOOT_APPLICATION_BOUND - 256) + return 1; + return 0; +} + static void ao_block_write(void) { @@ -87,12 +95,10 @@ ao_block_write(void) uint8_t data[256]; uint16_t i; - if (addr < (uint32_t) AO_BOOT_APPLICATION_BASE) { - ao_put_string("Invalid address\n"); - return; - } for (i = 0; i < 256; i++) data[i] = ao_usb_getchar(); + if (!ao_block_valid_address(addr)) + return; ao_flash_page(p, (void *) data); } @@ -104,18 +110,43 @@ ao_block_read(void) uint16_t i; uint8_t c; + if (!ao_block_valid_address(addr)) { + for (i = 0; i < 256; i++) + ao_usb_putchar(0xff); + return; + } for (i = 0; i < 256; i++) { c = *p++; ao_usb_putchar(c); } } +static inline void +hexchar(uint8_t c) +{ + if (c > 10) + c += 'a' - ('9' + 1); + ao_usb_putchar(c + '0'); +} + +static void +ao_put_hex(uint32_t u) +{ + int8_t i; + for (i = 28; i >= 0; i -= 4) + hexchar((u >> i) & 0xf); +} + static void ao_show_version(void) { ao_put_string("altos-loader"); ao_put_string("\nmanufacturer "); ao_put_string(ao_manufacturer); ao_put_string("\nproduct "); ao_put_string(ao_product); + ao_put_string("\nflash-range "); + ao_put_hex((uint32_t) AO_BOOT_APPLICATION_BASE); + ao_usb_putchar(' '); + ao_put_hex((uint32_t) AO_BOOT_APPLICATION_BOUND); ao_put_string("\nsoftware-version "); ao_put_string(ao_version); ao_put_string("\n"); } diff --git a/src/product/ao_micropeak.h b/src/product/ao_micropeak.h index 0cefca6f..0ec407d7 100644 --- a/src/product/ao_micropeak.h +++ b/src/product/ao_micropeak.h @@ -25,7 +25,9 @@ #define GROUND_AVG (1 << GROUND_AVG_SHIFT) /* Pressure change (in Pa) to detect boost */ +#ifndef BOOST_DETECT #define BOOST_DETECT 360 /* 30m at sea level, 36m at 2000m */ +#endif /* Wait after power on before doing anything to give the user time to assemble the rocket */ #define BOOST_DELAY AO_SEC_TO_TICKS(60) |