1 /* 2 * Copyright (c) 2016 RnDity Sp. z o.o. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief System/hardware module for STM32F3 processor 10 */ 11 12 #include <device.h> 13 #include <init.h> 14 #include <arch/cpu.h> 15 #include <arch/arm/aarch32/cortex_m/cmsis.h> 16 17 /** 18 * @brief Perform basic hardware initialization at boot. 19 * 20 * This needs to be run from the very beginning. 21 * So the init priority has to be 0 (zero). 22 * 23 * @return 0 24 */ stm32f3_init(const struct device * arg)25static int stm32f3_init(const struct device *arg) 26 { 27 uint32_t key; 28 29 ARG_UNUSED(arg); 30 31 key = irq_lock(); 32 33 /* Install default handler that simply resets the CPU 34 * if configured in the kernel, NOP otherwise 35 */ 36 NMI_INIT(); 37 38 irq_unlock(key); 39 40 /* Update CMSIS SystemCoreClock variable (HCLK) */ 41 /* At reset, system core clock is set to 8 MHz from HSI */ 42 SystemCoreClock = 8000000; 43 44 return 0; 45 } 46 47 SYS_INIT(stm32f3_init, PRE_KERNEL_1, 0); 48