From a24daa78d0fecce4c74c43789ea6c7b99c4d9ccf Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Sun, 4 Mar 2018 12:45:40 +0300 Subject: [PATCH] Fixed possibility of getting stuck in F7 bootloader mode (#5370) --- src/main/drivers/system_stm32f7xx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/drivers/system_stm32f7xx.c b/src/main/drivers/system_stm32f7xx.c index bfe8039dde..8bbbe3af98 100644 --- a/src/main/drivers/system_stm32f7xx.c +++ b/src/main/drivers/system_stm32f7xx.c @@ -197,6 +197,9 @@ void checkForBootLoaderRequest(void) bt = (*(__IO uint32_t *) (BKPSRAM_BASE + 4)) ; if ( bt == 0xDEADBEEF ) { (*(__IO uint32_t *) (BKPSRAM_BASE + 4)) = 0xCAFEFEED; // Reset our trigger + // Backup SRAM is write-back by default, ensure value actually reaches memory + // Another solution would be marking BKPSRAM as write-through in Memory Protection Unit settings + SCB_CleanDCache_by_Addr((uint32_t *) (BKPSRAM_BASE + 4), sizeof(uint32_t)); void (*SysMemBootJump)(void); __SYSCFG_CLK_ENABLE();