2012-03-17 17:33:26 -07:00
|
|
|
/*
|
2014-03-18 20:03:16 -07:00
|
|
|
* Copyright (c) 2012-2014 Travis Geiselbrecht
|
2012-03-17 17:33:26 -07:00
|
|
|
*
|
2019-07-05 17:22:23 -07:00
|
|
|
* Use of this source code is governed by a MIT-style
|
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
|
* https://opensource.org/licenses/MIT
|
2012-03-17 17:33:26 -07:00
|
|
|
*/
|
2019-06-17 18:28:51 -07:00
|
|
|
#include <lk/err.h>
|
|
|
|
|
#include <lk/debug.h>
|
2012-07-10 17:45:26 -07:00
|
|
|
#include <dev/uart.h>
|
2012-03-17 17:33:26 -07:00
|
|
|
#include <platform.h>
|
2012-04-10 14:23:37 -07:00
|
|
|
#include <platform/stm32.h>
|
2014-03-18 20:03:16 -07:00
|
|
|
#include <arch/arm/cm.h>
|
|
|
|
|
#include <stm32f10x_rcc.h>
|
2012-07-05 16:07:51 -07:00
|
|
|
#include "system_stm32f10x.h"
|
2012-03-17 17:33:26 -07:00
|
|
|
|
2019-06-19 20:54:28 -07:00
|
|
|
void platform_early_init(void) {
|
2016-02-14 12:24:01 -08:00
|
|
|
// Crank up the clock before initing timers.
|
|
|
|
|
SystemInit();
|
2012-07-05 16:07:51 -07:00
|
|
|
|
2016-02-14 12:24:01 -08:00
|
|
|
// start the systick timer
|
|
|
|
|
RCC_ClocksTypeDef clocks;
|
|
|
|
|
RCC_GetClocksFreq(&clocks);
|
|
|
|
|
arm_cm_systick_init(clocks.SYSCLK_Frequency);
|
2014-03-18 20:03:16 -07:00
|
|
|
|
2016-02-14 12:24:01 -08:00
|
|
|
stm32_timer_early_init();
|
|
|
|
|
stm32_gpio_early_init();
|
|
|
|
|
stm32_flash_nor_early_init();
|
2012-03-17 17:33:26 -07:00
|
|
|
}
|
|
|
|
|
|
2019-06-19 20:54:28 -07:00
|
|
|
void platform_init(void) {
|
2016-02-14 12:24:01 -08:00
|
|
|
stm32_timer_init();
|
|
|
|
|
stm32_flash_nor_init();
|
2012-03-17 17:33:26 -07:00
|
|
|
}
|