diff --git a/src/main/fc/init.c b/src/main/fc/init.c index 74a6fa4a89..ecc0644f3a 100644 --- a/src/main/fc/init.c +++ b/src/main/fc/init.c @@ -259,26 +259,6 @@ void sdCardAndFSInit() void init(void) { -#ifdef USE_HAL_DRIVER - HAL_Init(); -#endif - -#if defined(STM32F7) - /* Enable I-Cache */ - if (INSTRUCTION_CACHE_ENABLE) { - SCB_EnableICache(); - } - - /* Enable D-Cache */ - if (DATA_CACHE_ENABLE) { - SCB_EnableDCache(); - } - - if (PREFETCH_ENABLE) { - LL_FLASH_EnablePrefetch(); - } -#endif - #ifdef SERIAL_PORT_COUNT printfSerialInit(); #endif diff --git a/src/main/startup/system_stm32f30x.c b/src/main/startup/system_stm32f30x.c index b8a5b68906..1e76980d0f 100644 --- a/src/main/startup/system_stm32f30x.c +++ b/src/main/startup/system_stm32f30x.c @@ -202,6 +202,10 @@ void SystemInit(void) #else SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */ #endif + +#ifdef USE_HAL_DRIVER + HAL_Init(); +#endif } /** diff --git a/src/main/startup/system_stm32f4xx.c b/src/main/startup/system_stm32f4xx.c index 1d3457a58a..e29649326f 100644 --- a/src/main/startup/system_stm32f4xx.c +++ b/src/main/startup/system_stm32f4xx.c @@ -557,6 +557,10 @@ void SystemInit(void) SCB->VTOR = (uint32_t)&isr_vector_table_flash_base; #endif +#ifdef USE_HAL_DRIVER + HAL_Init(); +#endif + SystemCoreClockUpdate(); } diff --git a/src/main/startup/system_stm32f7xx.c b/src/main/startup/system_stm32f7xx.c index 2c080bde73..c0b0960ae4 100644 --- a/src/main/startup/system_stm32f7xx.c +++ b/src/main/startup/system_stm32f7xx.c @@ -348,6 +348,24 @@ void SystemInit(void) } SCB->VTOR = vtorOffset; +#ifdef USE_HAL_DRIVER + HAL_Init(); +#endif + + /* Enable I-Cache */ + if (INSTRUCTION_CACHE_ENABLE) { + SCB_EnableICache(); + } + + /* Enable D-Cache */ + if (DATA_CACHE_ENABLE) { + SCB_EnableDCache(); + } + + if (PREFETCH_ENABLE) { + LL_FLASH_EnablePrefetch(); + } + /* Configure the system clock to specified frequency */ SystemClock_Config(); diff --git a/src/main/startup/system_stm32h7xx.c b/src/main/startup/system_stm32h7xx.c index c07d7a241b..bbe262f55c 100644 --- a/src/main/startup/system_stm32h7xx.c +++ b/src/main/startup/system_stm32h7xx.c @@ -683,6 +683,10 @@ void SystemInit (void) SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ #endif +#ifdef USE_HAL_DRIVER + HAL_Init(); +#endif + SystemClock_Config(); SystemCoreClockUpdate();