summaryrefslogtreecommitdiff
path: root/src/stm-flash
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-03-11 13:21:04 -0700
committerKeith Packard <keithp@keithp.com>2013-03-11 13:21:04 -0700
commit06431e5195506f0d39105154de6eb046dfa152b6 (patch)
treebb3c9a2b5a4b3d30fab188349464671ae6e803c7 /src/stm-flash
parent994157be3d8272045183bc42237cd315d30d2187 (diff)
altos: Clean up boot loader support
Split out code into separate files. Add support for getting back to boot loader from application. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm-flash')
-rw-r--r--src/stm-flash/Makefile2
-rw-r--r--src/stm-flash/ao_pins.h5
-rw-r--r--src/stm-flash/ao_stm_flash.c8
3 files changed, 13 insertions, 2 deletions
diff --git a/src/stm-flash/Makefile b/src/stm-flash/Makefile
index 3c7b4966..e4a2f321 100644
--- a/src/stm-flash/Makefile
+++ b/src/stm-flash/Makefile
@@ -17,6 +17,8 @@ INC = \
#
ALTOS_SRC = \
ao_interrupt.c \
+ ao_boot_chain.c \
+ ao_boot_pin.c \
ao_product.c \
ao_romconfig.c \
ao_task.c \
diff --git a/src/stm-flash/ao_pins.h b/src/stm-flash/ao_pins.h
index ca53d844..382ef353 100644
--- a/src/stm-flash/ao_pins.h
+++ b/src/stm-flash/ao_pins.h
@@ -65,10 +65,13 @@
#define HAS_TASK_INFO 0
#define HAS_VERSION 0
+#define AO_BOOT_CHAIN 1
+#define AO_BOOT_PIN 1
+
#define AO_BOOT_APPLICATION_GPIO stm_gpioa
#define AO_BOOT_APPLICATION_PIN 0
#define AO_BOOT_APPLICATION_VALUE 1
#define AO_BOOT_APPLICATION_MODE 0
-#define AO_BOOT_APPLICATION_BASE 0x2000
+#define AO_BOOT_APPLICATION_BASE ((uint32_t *) 0x2000)
#endif /* _AO_PINS_H_ */
diff --git a/src/stm-flash/ao_stm_flash.c b/src/stm-flash/ao_stm_flash.c
index 16dd1189..968da9f1 100644
--- a/src/stm-flash/ao_stm_flash.c
+++ b/src/stm-flash/ao_stm_flash.c
@@ -25,8 +25,14 @@ ao_panic(uint8_t reason)
for (;;);
}
+void
+ao_application(void)
+{
+ ao_boot_reboot(AO_BOOT_APPLICATION_BASE);
+}
+
__code struct ao_cmds ao_flash_cmds[] = {
- { ao_reboot_application, "A\0Switch to application" },
+ { ao_application, "A\0Switch to application" },
{ 0, NULL },
};