26#ifndef CLK_F0F1F3_CFG_CLOCK_DEFAULT_H
27#define CLK_F0F1F3_CFG_CLOCK_DEFAULT_H
41#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE < MHZ(4) || CONFIG_CLOCK_HSE > MHZ(32))
42#error "HSE clock frequency must be between 4MHz and 32MHz"
56#ifndef CONFIG_CLOCK_PLL_PREDIV
57#if (IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(16))) || \
58 defined(CPU_LINE_STM32F303x6) || defined(CPU_LINE_STM32F303x8) || \
59 defined(CPU_LINE_STM32F303xB) || defined(CPU_LINE_STM32F303xC) || \
60 defined(CPU_LINE_STM32F328x8) || defined(CPU_LINE_STM32F358xC) || \
61 defined(CPU_LINE_STM32F031x6) || defined(CPU_LINE_STM32F042x6)
62#define CONFIG_CLOCK_PLL_PREDIV (2)
64#define CONFIG_CLOCK_PLL_PREDIV (1)
67#ifndef CONFIG_CLOCK_PLL_MUL
69#if defined(CPU_LINE_STM32F031x6) || defined(CPU_LINE_STM32F042x6)
70#define CONFIG_CLOCK_PLL_MUL (12)
72#define CONFIG_CLOCK_PLL_MUL (6)
75#if defined(CPU_LINE_STM32F303x6) || defined(CPU_LINE_STM32F303x8) || \
76 defined(CPU_LINE_STM32F303xB) || defined(CPU_LINE_STM32F303xC) || \
77 defined(CPU_LINE_STM32F328x8) || defined(CPU_LINE_STM32F358xC)
78#define CONFIG_CLOCK_PLL_MUL (16)
80#define CONFIG_CLOCK_PLL_MUL (9)
85#if IS_ACTIVE(CONFIG_USE_CLOCK_HSI)
86#define CLOCK_CORECLOCK (CONFIG_CLOCK_HSI)
88#elif IS_ACTIVE(CONFIG_USE_CLOCK_HSE)
89#if !IS_ACTIVE(CONFIG_BOARD_HAS_HSE)
90#error "The board doesn't provide an HSE oscillator"
92#define CLOCK_CORECLOCK (CONFIG_CLOCK_HSE)
94#elif IS_ACTIVE(CONFIG_USE_CLOCK_PLL)
95#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE)
96#define CLOCK_PLL_SRC (CONFIG_CLOCK_HSE)
98#define CLOCK_PLL_SRC (CONFIG_CLOCK_HSI)
109#define CLOCK_CORECLOCK ((CLOCK_PLL_SRC / CONFIG_CLOCK_PLL_PREDIV) * CONFIG_CLOCK_PLL_MUL)
110#ifdef CPU_FAM_STM32F0
111#if CLOCK_CORECLOCK > MHZ(48)
112#error "SYSCLK cannot exceed 48MHz"
115#if CLOCK_CORECLOCK > MHZ(72)
116#error "SYSCLK cannot exceed 72MHz"
121#define CLOCK_AHB CLOCK_CORECLOCK
123#ifndef CONFIG_CLOCK_APB1_DIV
124#ifdef CPU_FAM_STM32F0
125#define CONFIG_CLOCK_APB1_DIV (1)
127#define CONFIG_CLOCK_APB1_DIV (2)
130#define CLOCK_APB1 (CLOCK_AHB / CONFIG_CLOCK_APB1_DIV)
131#ifdef CPU_FAM_STM32F0
135#define CLOCK_APB2 (CLOCK_APB1)
137#ifndef CONFIG_CLOCK_APB2_DIV
138#define CONFIG_CLOCK_APB2_DIV (1)
140#define CLOCK_APB2 (CLOCK_AHB / CONFIG_CLOCK_APB2_DIV)
Base STM32Fx/Gx/MP1/C0 clock configuration.
Common macros and compiler attributes/pragmas configuration.