Skip to content

Commit 2a78a9b

Browse files
committed
Refactored code to not use macro. Created config xip-enable
1 parent ea032be commit 2a78a9b

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
void mailbox_init(void);
3232
#endif
3333

34-
#if defined(XIP_ENABLE)
34+
#if MBED_CONF_TARGET_XIP_ENABLE
3535
extern void qspi_xip_start();
3636
#endif
3737

@@ -103,7 +103,7 @@ void mbed_sdk_init(void)
103103
/* Enable global interrupts (disabled in CM4 startup assembly) */
104104
__enable_irq();
105105
#endif
106-
#if defined(XIP_ENABLE)
106+
#if MBED_CONF_TARGET_XIP_ENABLE
107107
qspi_xip_start();
108108
#endif
109109

targets/TARGET_Cypress/TARGET_PSOC6/xip_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
#ifdef XIP_ENABLE
18+
#if MBED_CONF_TARGET_XIP_ENABLE
1919
#include "cy_smif.h"
2020
#include "cy_smif_memslot.h"
2121
#include "cycfg_qspi_memslot.h"

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 & 6 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"),
@@ -990,12 +999,6 @@ def add_linker_defines(self):
990999
self.ld.append(define_string)
9911000
self.flags["ld"].append(define_string)
9921001

993-
if "XIP_ENABLE" in self.target.macros :
994-
define_string = self.make_ld_define(
995-
"XIP_ENABLE", 1)
996-
self.ld.append(define_string)
997-
self.flags["ld"].append(define_string)
998-
9991002
# Set the configuration data
10001003
def set_config_data(self, config_data):
10011004
self.config_data = config_data

0 commit comments

Comments
 (0)