mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +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:
parent
3695b123d9
commit
9054cd45bf
5 changed files with 30 additions and 20 deletions
|
@ -259,26 +259,6 @@ void sdCardAndFSInit()
|
||||||
|
|
||||||
void init(void)
|
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
|
#ifdef SERIAL_PORT_COUNT
|
||||||
printfSerialInit();
|
printfSerialInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -202,6 +202,10 @@ void SystemInit(void)
|
||||||
#else
|
#else
|
||||||
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
|
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_HAL_DRIVER
|
||||||
|
HAL_Init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -557,6 +557,10 @@ void SystemInit(void)
|
||||||
SCB->VTOR = (uint32_t)&isr_vector_table_flash_base;
|
SCB->VTOR = (uint32_t)&isr_vector_table_flash_base;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_HAL_DRIVER
|
||||||
|
HAL_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,24 @@ void SystemInit(void)
|
||||||
}
|
}
|
||||||
SCB->VTOR = vtorOffset;
|
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 */
|
/* Configure the system clock to specified frequency */
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
|
|
|
@ -683,6 +683,10 @@ void SystemInit (void)
|
||||||
SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_HAL_DRIVER
|
||||||
|
HAL_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue