Skip to content

Commit 4585232

Browse files
authored
Merge pull request #11006 from linlingao/pr10692
Introduce an Mbed config to enable XIP
2 parents 7c423db + 67c6bdb commit 4585232

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ void mbed_sdk_init(void)
9191
us_ticker_init();
9292
#endif
9393

94-
#if defined(CYBSP_ENABLE_FLASH_STORAGE)
94+
#if MBED_CONF_TARGET_XIP_ENABLE
9595
/* The linker script allows storing data in external memory, if needed, enable access to that memory. */
9696
cybsp_serial_flash_init();
9797
cybsp_serial_flash_enable_xip(true);
98-
#endif /* defined(CYBSP_ENABLE_FLASH_STORAGE) */
98+
#endif
9999

100100
/* Enable global interrupts (disabled in CM4 startup assembly) */
101101
__enable_irq();

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
"init-us-ticker-at-boot": {
5252
"help": "Initialize the microsecond ticker at boot rather than on first use, and leave it initialized. This speeds up wait_us in particular.",
5353
"value": false
54+
},
55+
"xip-enable": {
56+
"help": "Enable Execute In Place (XIP) on this target. Value is only significant if the board has executable external storage such as QSPIF. If this is enabled, customize the linker file to choose what text segments are placed on external storage",
57+
"value": false
5458
}
5559
}
5660
},

tools/toolchains/mbed_toolchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,7 @@ def add_regions(self):
953953

954954
STACK_PARAM = "target.boot-stack-size"
955955
TFM_LVL_PARAM = "tfm.level"
956+
XIP_ENABLE_PARAM = "target.xip-enable"
956957

957958
def add_linker_defines(self):
958959
params, _ = self.config_data
@@ -974,6 +975,14 @@ def add_linker_defines(self):
974975
self.ld.append(define_string)
975976
self.flags["ld"].append(define_string)
976977

978+
if self.XIP_ENABLE_PARAM in params:
979+
define_string = self.make_ld_define(
980+
"XIP_ENABLE",
981+
params[self.XIP_ENABLE_PARAM].value
982+
)
983+
self.ld.append(define_string)
984+
self.flags["ld"].append(define_string)
985+
977986
if self.target.is_PSA_secure_target:
978987
for flag, param in [
979988
("MBED_PUBLIC_RAM_START", "target.public-ram-start"),

0 commit comments

Comments
 (0)