diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld index a0efebb5a2..9640d1c4ab 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld @@ -216,8 +216,8 @@ SECTIONS __sgstubs_end = .; } > NSC_FLASH - __nu_tz_nsc_start = NU_TZ_NSC_START; - __nu_tz_nsc_size = NU_TZ_NSC_SIZE; + Load$$LR$$LR_IROM_NSC$$Base = NU_TZ_NSC_START; + Load$$LR$$LR_IROM_NSC$$Length = NU_TZ_NSC_SIZE; /* By IDAU, 0~0x4000 is secure. NSC can only locate in 0x4000~0x10000000. */ ASSERT(__sgstubs_start >= 0x4000, "By IDAU, 0~0x4000 is secure. NSC can only locate in 0x4000~0x10000000.") diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf index 66751d29f8..b8f0a850c3 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf @@ -92,8 +92,8 @@ if (isdefinedsymbol(DOMAIN_NS)) { if (! isdefinedsymbol(NU_TZ_NSC_START)) { define symbol NU_TZ_NSC_START = MBED_APP_START + MBED_APP_SIZE - 0x2000 - NU_TZ_NSC_SIZE; } - define exported symbol __NU_TZ_NSC_start__ = NU_TZ_NSC_START; - define exported symbol __NU_TZ_NSC_size__ = NU_TZ_NSC_SIZE; + define exported symbol Load$$LR$$LR_IROM_NSC$$Base = NU_TZ_NSC_START; + define exported symbol Load$$LR$$LR_IROM_NSC$$Length = NU_TZ_NSC_SIZE; /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = MBED_APP_START; diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h index 442c00d84d..b282ddf494 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/partition_M2351.h @@ -24,32 +24,14 @@ #define NU_TZ_SECURE_FLASH_SIZE NU_ROM_SIZE_S #define NU_TZ_SECURE_SRAM_SIZE NU_RAM_SIZE_S -#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) - +/* We make exported symbols consistent across toolchains. This helps for porting e.g. TFM. + * Because Keil scatter file doesn't support custom exported symbols, other toolchains's + * linker files must export the same symbol names as region names in Keil scatter file. */ extern int Load$$LR$$LR_IROM_NSC$$Base; extern int Load$$LR$$LR_IROM_NSC$$Length; - #define NU_TZ_NSC_REGION_START ((uint32_t) &Load$$LR$$LR_IROM_NSC$$Base) #define NU_TZ_NSC_REGION_SIZE ((uint32_t) &Load$$LR$$LR_IROM_NSC$$Length) -#elif defined(__ICCARM__) - -extern int __NU_TZ_NSC_start__; -extern int __NU_TZ_NSC_size__; - -#define NU_TZ_NSC_REGION_START ((uint32_t) &__NU_TZ_NSC_start__) -#define NU_TZ_NSC_REGION_SIZE ((uint32_t) &__NU_TZ_NSC_size__) - -#elif defined(__GNUC__) - -extern int __nu_tz_nsc_start; -extern int __nu_tz_nsc_size; - -#define NU_TZ_NSC_REGION_START ((uint32_t) &__nu_tz_nsc_start) -#define NU_TZ_NSC_REGION_SIZE ((uint32_t) &__nu_tz_nsc_size) - -#endif - /* Check relevant macros have been defined */ #if (! defined(NU_TZ_SECURE_FLASH_SIZE)) #error("NU_TZ_SECURE_FLASH_SIZE not defined")