diff --git a/src/main/drivers/system_stm32f7xx.c b/src/main/drivers/system_stm32f7xx.c index d7f8ba4adf..d899772668 100644 --- a/src/main/drivers/system_stm32f7xx.c +++ b/src/main/drivers/system_stm32f7xx.c @@ -154,6 +154,8 @@ bool isMPUSoftReset(void) void systemInit(void) { + checkForBootLoaderRequest(); + // Mark ITCM-RAM as read-only LL_MPU_ConfigRegion(LL_MPU_REGION_NUMBER0, 0, RAMITCM_BASE, LL_MPU_REGION_SIZE_16KB | LL_MPU_REGION_PRIV_RO_URO); LL_MPU_Enable(LL_MPU_CTRL_PRIVILEGED_DEFAULT); @@ -198,11 +200,16 @@ void checkForBootLoaderRequest(void) } void (*SysMemBootJump)(void); + __SYSCFG_CLK_ENABLE(); SYSCFG->MEMRMP |= SYSCFG_MEM_BOOT_ADD0 ; + uint32_t p = (*((uint32_t *) 0x1ff00000)); - __set_MSP(p); //Set the main stack pointer to its defualt values + + __set_MSP(p); //Set the main stack pointer to its default values + SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1ff00004)); // Point the PC to the System Memory reset vector (+4) SysMemBootJump(); + while (1); } diff --git a/src/main/startup/startup_stm32f722xx.s b/src/main/startup/startup_stm32f722xx.s index 4deebf2b74..580a99205e 100644 --- a/src/main/startup/startup_stm32f722xx.s +++ b/src/main/startup/startup_stm32f722xx.s @@ -84,7 +84,6 @@ Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl persistentObjectInit - bl checkForBootLoaderRequest /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 diff --git a/src/main/startup/startup_stm32f745xx.s b/src/main/startup/startup_stm32f745xx.s index bb4fa6cb27..9d7f7b6063 100644 --- a/src/main/startup/startup_stm32f745xx.s +++ b/src/main/startup/startup_stm32f745xx.s @@ -84,7 +84,6 @@ Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl persistentObjectInit - bl checkForBootLoaderRequest /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 diff --git a/src/main/startup/startup_stm32f746xx.s b/src/main/startup/startup_stm32f746xx.s index f57a73cc0c..6f3fc401f9 100644 --- a/src/main/startup/startup_stm32f746xx.s +++ b/src/main/startup/startup_stm32f746xx.s @@ -84,7 +84,6 @@ Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl persistentObjectInit - bl checkForBootLoaderRequest /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 diff --git a/src/main/startup/startup_stm32f765xx.s b/src/main/startup/startup_stm32f765xx.s index 99d129d0a2..47bb4cf93c 100644 --- a/src/main/startup/startup_stm32f765xx.s +++ b/src/main/startup/startup_stm32f765xx.s @@ -84,7 +84,6 @@ Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl persistentObjectInit - bl checkForBootLoaderRequest /* Copy the data segment initializers from flash to SRAM */ movs r1, #0