From c5494eb7513776dd7c815093df06dd7f13193846 Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Tue, 4 Jul 2017 11:34:18 +0800 Subject: [PATCH] [M2351] Support __vector_table instead of __vector_handlers in IAR --- .../TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c | 4 +++- .../TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c index 970b0707c3..b846bfd8cf 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c @@ -398,6 +398,7 @@ void Default_Handler(void) } +#if defined(__CC_ARM) uint32_t GetPC(void) { uint32_t val=0; @@ -407,4 +408,5 @@ __asm { MOV val, R0 } return val; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c b/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c index 3fd2f01d7b..9e313edcc6 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.c @@ -19,8 +19,11 @@ #endif - +#if defined(__ICCARM__) +extern void *__vector_table; /* see startup file */ +#else extern void *__vector_handlers; /* see startup file */ +#endif extern uint32_t GetPC(void); /* Get current program counter(PC) */ @@ -70,8 +73,12 @@ void SystemInit(void) { #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +#if defined(__ICCARM__) + SCB->VTOR = (uint32_t) &__vector_table; +#else SCB->VTOR = (uint32_t) &__vector_handlers; #endif +#endif #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) TZ_SAU_Setup();