From ad0466f423d796c722e08ab6860c4ccf797720e6 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 5 May 2025 14:21:45 +0200 Subject: [PATCH] soc: st: stm32 Kconfig to retrieve the external Flash Base address This commit is retrieving the config FLASH_BASE_ADDRESS from the XSPI node of the stm32 device dtsi property of the "st,stm32-xspi" node. For example the CONFIG_FLASH_BASE_ADDRESS is 0x90000000 and application is linked for that address. Size is given by the size property of the "st,stm32-xspi-nor" node. Signed-off-by: Francois Ramu --- soc/st/stm32/Kconfig.defconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig index 1cf916d1611..18f343b9324 100644 --- a/soc/st/stm32/Kconfig.defconfig +++ b/soc/st/stm32/Kconfig.defconfig @@ -26,6 +26,13 @@ DT_STM32_RCC_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_RCC_PATH),clock-fre 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_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)) + config SYS_CLOCK_HW_CYCLES_PER_SEC default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" @@ -73,4 +80,9 @@ config USE_DT_CODE_PARTITION 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) + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) + endif # SOC_FAMILY_STM32