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 934f928596c..916b1efe7fa 100644 --- a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld +++ b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld @@ -17,16 +17,14 @@ #include #include -#if CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP +#if defined(CONFIG_NORDIC_QSPI_NOR) && defined(CONFIG_SOC_NRF5340_CPUAPP) -/* - * nRF5340dk is shipping a QSPI external flash mapped at 0x1000_0000 that can - * be used for XIP - */ -MEMORY -{ - EXTFLASH (wx) : ORIGIN = 0x10000000, LENGTH = 0x800000 -} +/* On nRF5340, external flash is mapped in XIP region at 0x1000_0000. */ + +#define EXTFLASH_NODE DT_INST(0, nordic_qspi_nor) +#define EXTFLASH_ADDR 0x10000000 +#define EXTFLASH_SIZE DT_PROP_OR(EXTFLASH_NODE, size_in_bytes, \ + DT_PROP(EXTFLASH_NODE, size) / 8) #else @@ -37,11 +35,11 @@ MEMORY #define EXTFLASH_ADDR 0x5000 #define EXTFLASH_SIZE (CONFIG_FLASH_SIZE * 1K - EXTFLASH_ADDR) +#endif + MEMORY { - EXTFLASH (wx) : ORIGIN = 0x5000, LENGTH = EXTFLASH_SIZE + EXTFLASH (rx) : ORIGIN = EXTFLASH_ADDR, LENGTH = EXTFLASH_SIZE } -#endif /* CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP */ - #include