summaryrefslogtreecommitdiff
path: root/src/stm-demo
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-03-11 13:21:04 -0700
committerKeith Packard <keithp@keithp.com>2013-05-07 20:16:36 -0700
commitb1a43ce313c85cb7f8f16f7f0647d9d4320ba692 (patch)
tree932b1768bc85c5ef5865d6acd61eac22a8584dcc /src/stm-demo
parent56a7cbbf51f5c9ebbfe17d1cc30ed807572af3cc (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-demo')
-rw-r--r--src/stm-demo/Makefile1
-rw-r--r--src/stm-demo/ao_demo.c9
-rw-r--r--src/stm-demo/ao_pins.h2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/stm-demo/Makefile b/src/stm-demo/Makefile
index ab12f47b..e6cd55e4 100644
--- a/src/stm-demo/Makefile
+++ b/src/stm-demo/Makefile
@@ -17,6 +17,7 @@ INC = \
#
ALTOS_SRC = \
ao_interrupt.c \
+ ao_boot_chain.c \
ao_product.c \
ao_romconfig.c \
ao_cmd.c \
diff --git a/src/stm-demo/ao_demo.c b/src/stm-demo/ao_demo.c
index 9ee0be03..ec572fdc 100644
--- a/src/stm-demo/ao_demo.c
+++ b/src/stm-demo/ao_demo.c
@@ -20,6 +20,7 @@
#include <ao_event.h>
#include <ao_quadrature.h>
#include <ao_button.h>
+#include <ao_boot.h>
struct ao_task demo_task;
@@ -168,6 +169,13 @@ ao_event(void)
}
+static void
+ao_boot_loader(void)
+{
+ flush();
+ ao_boot_reboot((uint32_t *) 0);
+}
+
__code struct ao_cmds ao_demo_cmds[] = {
{ ao_dma_test, "D\0DMA test" },
{ ao_spi_write, "W\0SPI write" },
@@ -175,6 +183,7 @@ __code struct ao_cmds ao_demo_cmds[] = {
{ ao_i2c_write, "i\0I2C write" },
{ ao_temp, "t\0Show temp" },
{ ao_event, "e\0Monitor event queue" },
+ { ao_boot_loader, "L\0Reboot to boot loader" },
{ 0, NULL }
};
diff --git a/src/stm-demo/ao_pins.h b/src/stm-demo/ao_pins.h
index 07b4a19d..40e48a36 100644
--- a/src/stm-demo/ao_pins.h
+++ b/src/stm-demo/ao_pins.h
@@ -68,6 +68,8 @@
#define HAS_BEEP 0
#define PACKET_HAS_SLAVE 0
+#define AO_BOOT_CHAIN 1
+
#define LOW_LEVEL_DEBUG 1
#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOBEN