1 /*
2  * Copyright (c) 2012 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #include <lk/err.h>
9 #include <lk/debug.h>
10 #include <dev/uart.h>
11 #include <platform.h>
12 #include <platform/stm32.h>
13 #include <arch/arm/cm.h>
14 #include <stm32f4xx_rcc.h>
15 #include "system_stm32f4xx.h"
16 
platform_early_init(void)17 void platform_early_init(void) {
18     // Crank up the clock before initing timers.
19     SystemInit();
20 
21     // start the systick timer
22     RCC_ClocksTypeDef clocks;
23     RCC_GetClocksFreq(&clocks);
24     arm_cm_systick_init(clocks.SYSCLK_Frequency);
25 
26     stm32_timer_early_init();
27     stm32_gpio_early_init();
28 }
29 
platform_init(void)30 void platform_init(void) {
31     stm32_timer_init();
32 }
33