[M2351] Make exported NSC symbols consistent across toolchains

This idea comes from TFM.
pull/10959/head
ccli8 2019-01-15 17:29:48 +08:00 committed by Chun-Chieh Li
parent 85dfc1a971
commit 1aca8a5b56
3 changed files with 7 additions and 25 deletions

View File

@ -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.")

View File

@ -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;

View File

@ -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")