altos: Fix STM flash programming
[fw/altos] / src / stm-demo / ao_demo.c
index b82cb73512711942778b36b4121c919ca033e676..ec572fdc204a8a8871046085b91a73ac6f981a50 100644 (file)
@@ -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 }
 };
 
@@ -183,6 +192,8 @@ main(void)
 {
        ao_clock_init();
        
+       ao_task_init();
+
        ao_serial_init();
        ao_timer_init();
        ao_dma_init();