summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
16c3f54)
When rebooting, make sure the option bytes are recomputed based upon
the latest flash configuration, including whether there's a program
loaded. This ensures that we don't end up re-starting the DFU loader
and mangling our ao_boot values. Without this, our flash loader code
wouldn't be able to see the signal to stay in the loader and we'd end
up back in the application.
Of course, this is only necessary if we want to reboot just after
flashing the boot loader without power cycling. Once the chip is power
cycled, it recomputes the option bytes automatically.
Signed-off-by: Keith Packard <keithp@keithp.com>
#define __interrupt(n)
#define __at(n)
#define __interrupt(n)
#define __at(n)
-#define ao_arch_reboot() \
- (stm_scb.aircr = ((STM_SCB_AIRCR_VECTKEY_KEY << STM_SCB_AIRCR_VECTKEY) | \
- (1 << STM_SCB_AIRCR_SYSRESETREQ)))
+static inline void ao_arch_reboot(void) {
+ stm_flash.cr = (1 << STM_FLASH_CR_OBL_LAUNCH);
+ stm_scb.aircr = ((STM_SCB_AIRCR_VECTKEY_KEY << STM_SCB_AIRCR_VECTKEY) |
+ (1 << STM_SCB_AIRCR_SYSRESETREQ));
+}
#define ao_arch_nop() asm("nop")
#define ao_arch_nop() asm("nop")