void platform_early_init(void) { // Do general system init SystemInit(); SystemClock_Config(); // Enable the flash ART controller __HAL_FLASH_ART_ENABLE(); __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); /* read the unique id */ stm32_unique_id[0] = *REG32(0x1ff0f420); stm32_unique_id[1] = *REG32(0x1ff0f424); stm32_unique_id[2] = *REG32(0x1ff0f428); /* seed the random number generator based on this */ srand(stm32_unique_id[0] ^ stm32_unique_id[1] ^ stm32_unique_id[2]); // Start the systick timer uint32_t sysclk = HAL_RCC_GetSysClockFreq(); arm_cm_systick_init(sysclk); stm32_timer_early_init(); stm32_gpio_early_init(); stm32_flash_early_init(); stm32_rng_init(); /* clear the reboot reason */ RCC->CSR |= (1<<24); // ITM_SendChar('1'); }
void platform_early_init(void) { // Crank up the clock before initing timers. SystemInit(); stm32_timer_early_init(); stm32_gpio_early_init(); }