| # ST Microelectronics STM32 all MCU lines |
| |
| # Copyright (c) 2017, I-SENSE group of ICCS |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # Default configurations applied to the whole STM32 family |
| |
| if SOC_FAMILY_STM32 |
| |
| # Source series Kconfig files first, so SoCs |
| # can override the defaults given here |
| rsource "*/Kconfig.defconfig" |
| |
| config CACHE_STM32 |
| default y if EXTERNAL_CACHE |
| |
| config CLOCK_CONTROL |
| default y |
| |
| config CORTEX_M_SYSTICK |
| default n if STM32_LPTIM_TIMER |
| |
| DT_STM32_RCC_PATH := $(dt_nodelabel_path,rcc) |
| DT_STM32_RCC_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_RCC_PATH),clock-frequency) |
| |
| DT_STM32WB0_RADIO_TIMER_PATH := $(dt_nodelabel_path,radio_timer) |
| DT_STM32WB0_TIMER_FREQ := $(dt_node_int_prop_int,$(DT_STM32WB0_RADIO_TIMER_PATH),compensated-timer-freq) |
| |
| DT_ST_PRESCALER := st,prescaler |
| DT_STM32_LPTIM_PATH := $(dt_nodelabel_path,stm32_lp_tick_source) |
| |
| DT_CHOSEN_Z_FLASH := zephyr,flash |
| DT_COMPAT_XSPI := st,stm32-xspi |
| DT_COMPAT_OSPI := st,stm32-ospi |
| DT_COMPAT_QSPI := st,stm32-qspi |
| |
| DT_CHOSEN_FLASH_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH)) |
| DT_CHOSEN_FLASH_PARENT := $(dt_node_parent,$(DT_CHOSEN_FLASH_NODE)) |
| DT_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_XSPI)) |
| DT_FLASH_PARENT_IS_OSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_OSPI)) |
| DT_FLASH_PARENT_IS_QSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_QSPI)) |
| |
| config SYS_CLOCK_HW_CYCLES_PER_SEC |
| default "$(DT_STM32WB0_TIMER_FREQ)" if STM32WB0_RADIO_TIMER |
| default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" |
| |
| config LOG_BACKEND_SWO_REF_FREQ_HZ |
| default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" |
| depends on LOG_BACKEND_SWO |
| |
| # If sysclock is not LPTIM, tick of 10000 is too high for a frequency lower than 32MHz |
| config SYS_CLOCK_TICKS_PER_SEC |
| default 8000 if SYS_CLOCK_HW_CYCLES_PER_SEC <= 32000000 |
| depends on !STM32_LPTIM_TIMER |
| |
| # set the tick per sec as a divider of the LPTIM clock source |
| # with a minimum value of 4096 for SYS_CLOCK_TICKS_PER_SEC to keep |
| # SYS_CLOCK_TICKS_PER_SEC not too high compared to the LPTIM counter clock |
| config SYS_CLOCK_TICKS_PER_SEC |
| default 4096 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" < 16 |
| default 2048 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 16 |
| default 1024 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 32 |
| default 512 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 64 |
| default 256 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 128 |
| depends on STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSE |
| |
| config SYS_CLOCK_TICKS_PER_SEC |
| default 4000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" < 16 |
| default 2000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 16 |
| default 1000 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 32 |
| default 500 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 64 |
| default 250 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 128 |
| depends on STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSI |
| |
| choice STM32_LPTIM_CLOCK |
| default STM32_LPTIM_CLOCK_LSE if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 2 |
| default STM32_LPTIM_CLOCK_LSI if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 3 |
| endchoice |
| |
| config CLOCK_CONTROL_INIT_PRIORITY |
| default 1 |
| depends on CLOCK_CONTROL |
| |
| # Get flash configuration for NS image from dts flash partition |
| config USE_DT_CODE_PARTITION |
| default y if TRUSTED_EXECUTION_NONSECURE |
| |
| config BUILD_WITH_TFM |
| default y if TRUSTED_EXECUTION_NONSECURE |
| |
| config FLASH_BASE_ADDRESS |
| default $(dt_node_reg_addr_hex,$(DT_CHOSEN_FLASH_PARENT),1) \ |
| if $(DT_FLASH_PARENT_IS_XSPI) || $(DT_FLASH_PARENT_IS_OSPI) || $(DT_FLASH_PARENT_IS_QSPI) |
| default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) |
| |
| config STM32_APP_IN_EXT_FLASH |
| default $(DT_FLASH_PARENT_IS_XSPI) |
| |
| # The XSPI PSRAM driver creates a SMH region with attribute SMH_REG_ATTR_EXTERNAL (2) |
| # If applicable set the LTDC / VIDEO_BUFFER SMH attribute to SMH_REG_ATTR_EXTERNAL (2) |
| # in order to be able to allocate from the XSPI PSRAM |
| if MEMC_STM32_XSPI_PSRAM && SHARED_MULTI_HEAP |
| |
| config STM32_LTDC_FB_SMH_ATTRIBUTE |
| default 2 if STM32_LTDC_FB_USE_SHARED_MULTI_HEAP |
| |
| config VIDEO_BUFFER_SMH_ATTRIBUTE |
| default 2 if VIDEO_BUFFER_USE_SHARED_MULTI_HEAP |
| |
| endif # MEMC_STM32_XSPI_PSRAM && SHARED_MULTI_HEAP |
| |
| config VIDEO_BUFFER_POOL_ALIGN |
| default 16 if VIDEO_STM32_DCMIPP |
| |
| config STM32_BACKUP_PROTECTION |
| default y if !SOC_SERIES_STM32C0X && !SOC_SERIES_STM32WB0X |
| |
| endif # SOC_FAMILY_STM32 |