samples: code_relocation_nocopy: Make linker script more generic
Instead of depending on the nRF5340 DK, use a path specific to just the nRF5340 SoC and get the size of the external flash in this case from devicetree so that the sample could be easily run on other boards based on the nRF5340 SoC (after just adding proper overlays). On the occasion, correct the attributes of the EXTFLASH memory region. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
6bd6f4be65
commit
e3ee5c09f2
1 changed files with 10 additions and 12 deletions
|
@ -17,16 +17,14 @@
|
|||
#include <zephyr/linker/linker-defs.h>
|
||||
#include <zephyr/linker/linker-tool.h>
|
||||
|
||||
#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 <zephyr/arch/arm/cortex_m/scripts/linker.ld>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue