1# ST Microelectronics STM32 all MCU lines 2 3# Copyright (c) 2017, I-SENSE group of ICCS 4# SPDX-License-Identifier: Apache-2.0 5 6# Default configurations appplied tp the whole STM32 family 7 8if SOC_FAMILY_STM32 9 10rsource "*/Kconfig.defconfig" 11 12config CLOCK_CONTROL 13 default y 14 15config CORTEX_M_SYSTICK 16 default n if STM32_LPTIM_TIMER 17 18DT_STM32_RCC_PATH := $(dt_nodelabel_path,rcc) 19DT_STM32_RCC_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_RCC_PATH),clock-frequency) 20 21DT_ST_PRESCALER := st,prescaler 22DT_STM32_LPTIM_PATH := $(dt_nodelabel_path,stm32_lp_tick_source) 23 24config SYS_CLOCK_HW_CYCLES_PER_SEC 25 default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" 26 27config LOG_BACKEND_SWO_REF_FREQ_HZ 28 default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" 29 depends on LOG_BACKEND_SWO 30 31# If sysclock is not LPTIM, tick of 10000 is too high for a frequency lower than 32MHz 32config SYS_CLOCK_TICKS_PER_SEC 33 default 8000 if SYS_CLOCK_HW_CYCLES_PER_SEC <= 32000000 34 depends on !STM32_LPTIM_TIMER 35 36# set the tick per sec as a divider of the LPTIM clock source 37# with a minimum value of 4096 for SYS_CLOCK_TICKS_PER_SEC to keep 38# SYS_CLOCK_TICKS_PER_SEC not too high compared to the LPTIM counter clock 39config SYS_CLOCK_TICKS_PER_SEC 40 default 4096 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" < 16 41 default 2048 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 16 42 default 1024 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 32 43 default 512 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 64 44 default 256 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 128 45 depends on STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSE 46 47config SYS_CLOCK_TICKS_PER_SEC 48 default 4000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" < 16 49 default 2000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 16 50 default 1000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 32 51 default 500 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 64 52 default 250 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 128 53 depends on STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSI 54 55choice STM32_LPTIM_CLOCK 56 default STM32_LPTIM_CLOCK_LSE if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 2 57 default STM32_LPTIM_CLOCK_LSI if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 3 58endchoice 59 60config CLOCK_CONTROL_INIT_PRIORITY 61 default 1 62 depends on CLOCK_CONTROL 63 64config PHY_INIT_PRIORITY 65 default 81 66 depends on NET_L2_ETHERNET && ETH_DRIVER 67 68# Get flash configuration for NS image from dts flash partition 69config USE_DT_CODE_PARTITION 70 default y if TRUSTED_EXECUTION_NONSECURE 71 72config BUILD_WITH_TFM 73 default y if TRUSTED_EXECUTION_NONSECURE 74 75endif # SOC_FAMILY_STM32 76