2016-10-28 16:47:15 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 RnDity Sp. z o.o.
|
|
|
|
*
|
2017-01-19 23:38:51 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-10-28 16:47:15 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief System/hardware module for STM32F3 processor
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <device.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <arch/cpu.h>
|
2019-10-24 23:08:21 +08:00
|
|
|
#include <arch/arm/cortex_m/cmsis.h>
|
2016-10-28 16:47:15 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Perform basic hardware initialization at boot.
|
|
|
|
*
|
|
|
|
* This needs to be run from the very beginning.
|
|
|
|
* So the init priority has to be 0 (zero).
|
|
|
|
*
|
|
|
|
* @return 0
|
|
|
|
*/
|
|
|
|
static int stm32f3_init(struct device *arg)
|
|
|
|
{
|
2017-04-21 02:30:33 +08:00
|
|
|
u32_t key;
|
2016-10-28 16:47:15 +08:00
|
|
|
|
|
|
|
ARG_UNUSED(arg);
|
|
|
|
|
|
|
|
key = irq_lock();
|
|
|
|
|
|
|
|
/* Install default handler that simply resets the CPU
|
|
|
|
* if configured in the kernel, NOP otherwise
|
|
|
|
*/
|
|
|
|
NMI_INIT();
|
|
|
|
|
|
|
|
irq_unlock(key);
|
|
|
|
|
2017-01-11 21:38:52 +08:00
|
|
|
/* Update CMSIS SystemCoreClock variable (HCLK) */
|
2017-12-23 05:00:12 +08:00
|
|
|
/* At reset, system core clock is set to 8 MHz from HSI */
|
|
|
|
SystemCoreClock = 8000000;
|
2017-01-25 20:41:38 +08:00
|
|
|
|
2016-10-28 16:47:15 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SYS_INIT(stm32f3_init, PRE_KERNEL_1, 0);
|