samples: code_relocation_nocopy: update macro to get flash size
The flash size is the second part (size) of the first reg value,
not the first part (address) of a nonexistent second reg value.
DT_REG_SIZE get a node's (only) register block size instead
DT_REG_ADDR_BY_IDX .
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
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 0a11783..5e69fab 100644
--- a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld
+++ b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld
@@ -31,21 +31,21 @@
#define EXTFLASH_NODE DT_INST(0, st_stm32_ospi_nor)
#define EXTFLASH_ADDR DT_REG_ADDR(DT_INST(0, st_stm32_ospi_nor))
-#define EXTFLASH_SIZE DT_REG_ADDR_BY_IDX(DT_INST(0, st_stm32_ospi_nor), 1)
+#define EXTFLASH_SIZE DT_REG_SIZE(DT_INST(0, st_stm32_ospi_nor))
#elif defined(CONFIG_STM32_MEMMAP) && DT_NODE_EXISTS(DT_INST(0, st_stm32_qspi_nor))
/* 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_ADDR_BY_IDX(DT_INST(0, st_stm32_qspi_nor), 1)
+#define EXTFLASH_SIZE DT_REG_SIZE(DT_INST(0, st_stm32_ospi_nor))
#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(DT_INST(0, st_stm32_xspi_nor))
-#define EXTFLASH_SIZE DT_REG_ADDR_BY_IDX(DT_INST(0, st_stm32_xspi_nor), 1)
+#define EXTFLASH_SIZE DT_REG_SIZE(DT_INST(0, st_stm32_ospi_nor))
#elif defined(CONFIG_FLASH_MSPI_NOR) && defined(CONFIG_SOC_NRF54H20_CPUAPP)