From 45ce78adf092a4a562f366fc84da455c41036f5a Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 14 May 2025 14:48:20 +0200 Subject: [PATCH] samples: code_relocation_nocopy: update macro for flash size and address In case of the st,stm32-qspi-nor compatible new property and node definitions will requires new macro to get the external NOR flash base address and size Add the config for running the sample on stm32l475 disco kit Signed-off-by: Francois Ramu --- .../code_relocation_nocopy/boards/disco_l475_iot1.conf | 2 ++ .../code_relocation_nocopy/linker_arm_nocopy.ld | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 samples/application_development/code_relocation_nocopy/boards/disco_l475_iot1.conf diff --git a/samples/application_development/code_relocation_nocopy/boards/disco_l475_iot1.conf b/samples/application_development/code_relocation_nocopy/boards/disco_l475_iot1.conf new file mode 100644 index 00000000000..eac2504a785 --- /dev/null +++ b/samples/application_development/code_relocation_nocopy/boards/disco_l475_iot1.conf @@ -0,0 +1,2 @@ +CONFIG_FLASH=y +CONFIG_STM32_MEMMAP=y diff --git a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld index 4d5c38e0d81..8880703cebd 100644 --- a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld +++ b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld @@ -37,15 +37,15 @@ /* On stm32 QSPI, external flash is mapped in XIP region at address given by the reg property. */ #define EXTFLASH_NODE DT_INST(0, st_stm32_qspi_nor) -#define EXTFLASH_ADDR DT_REG_ADDR(DT_INST(0, st_stm32_qspi_nor)) -#define EXTFLASH_SIZE DT_REG_SIZE(DT_INST(0, st_stm32_qspi_nor)) +#define EXTFLASH_ADDR DT_REG_ADDR_BY_IDX(DT_PARENT(EXTFLASH_NODE), 1) +#define EXTFLASH_SIZE (DT_PROP(EXTFLASH_NODE, size) / 8) #elif defined(CONFIG_STM32_MEMMAP) && DT_NODE_EXISTS(DT_INST(0, st_stm32_xspi_nor)) /* On stm32 XSPI, external flash is mapped in XIP region at address given by the reg property. */ #define EXTFLASH_NODE DT_INST(0, st_stm32_xspi_nor) #define EXTFLASH_ADDR DT_REG_ADDR_BY_IDX(DT_PARENT(EXTFLASH_NODE), 1) -#define EXTFLASH_SIZE DT_PROP(EXTFLASH_NODE, size) / 8 +#define EXTFLASH_SIZE (DT_PROP(EXTFLASH_NODE, size) / 8) #elif defined(CONFIG_FLASH_MSPI_NOR) && defined(CONFIG_SOC_NRF54H20_CPUAPP)