1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Move HAL_Init call for F3/F4/F7/H7.

* HAL_Delay() was being used before HAL_Init() was called.
* Brings it in-line with ST examples which follow this call order:
CubeMX generated code goes startup_xxx.s (asm) -> SystemInit(), then
main(), HAL_Init(), SystemClock_Config()

Boot-tested on:
* SPRacingF4NEO
* SPRacingF7DUAL
* SPRacingH7ZERO
This commit is contained in:
Dominic Clifton 2019-02-20 18:40:52 +01:00
parent 3695b123d9
commit 9054cd45bf
5 changed files with 30 additions and 20 deletions

View file

@ -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

View file

@ -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
}
/**

View file

@ -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();
}

View file

@ -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();

View file

@ -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();