From 0be7de013ef56b87dd3ff530a779aa932be62fe3 Mon Sep 17 00:00:00 2001 From: Deepika Date: Thu, 14 Sep 2017 11:21:19 -0500 Subject: [PATCH] ARMC6 compiler related changes --- targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h | 2 +- targets/TARGET_NUVOTON/TARGET_M2351/device/M2351_funcs.S | 4 ++-- .../TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/sys.cpp | 6 +++++- .../TARGET_M2351/device/TOOLCHAIN_ARM_STD/sys.cpp | 6 +++++- targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis.h | 2 +- targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis_nvic.h | 2 +- .../TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c | 8 ++++---- targets/targets.json | 2 +- 8 files changed, 20 insertions(+), 12 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h index 655ab0dfcb..ae5f6b73b2 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351.h @@ -31508,7 +31508,7 @@ typedef struct #pragma pop #elif defined (__ICCARM__) /* leave anonymous unions enabled */ -#elif (__ARMCC_VERSION >= 6010050) +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #pragma clang diagnostic pop #elif defined (__GNUC__) /* anonymous unions are enabled by default */ diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351_funcs.S b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351_funcs.S index 0c06e08a0b..5a15dbb1c0 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351_funcs.S +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/M2351_funcs.S @@ -1,4 +1,4 @@ -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) AREA |.text|, CODE, READONLY __PC PROC EXPORT __PC @@ -23,7 +23,7 @@ __PC BLX lr -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) ALIGN END #elif defined(__GNUC__) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/sys.cpp b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/sys.cpp index 9060f11039..abf213c62b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/sys.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/sys.cpp @@ -9,13 +9,17 @@ extern "C" { #endif +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) +#include +#endif + #include #include extern char Image$$ARM_LIB_STACK$$ZI$$Limit[]; extern char Image$$ARM_LIB_HEAP$$Base[]; extern char Image$$ARM_LIB_HEAP$$ZI$$Limit[]; -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { +extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { struct __initial_stackheap r; r.heap_base = (uint32_t)Image$$ARM_LIB_HEAP$$Base; diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/sys.cpp b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/sys.cpp index 9060f11039..abf213c62b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/sys.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/sys.cpp @@ -9,13 +9,17 @@ extern "C" { #endif +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) +#include +#endif + #include #include extern char Image$$ARM_LIB_STACK$$ZI$$Limit[]; extern char Image$$ARM_LIB_HEAP$$Base[]; extern char Image$$ARM_LIB_HEAP$$ZI$$Limit[]; -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { +extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { struct __initial_stackheap r; r.heap_base = (uint32_t)Image$$ARM_LIB_HEAP$$Base; diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis.h index 5330b14bb6..723bd8216f 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis.h @@ -21,7 +21,7 @@ #include "cmsis_nvic.h" // Support linker-generated symbol as start of relocated vector table. -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) extern uint32_t Image$$ER_IRAMVEC$$ZI$$Base; #elif defined(__ICCARM__) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis_nvic.h b/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis_nvic.h index c99851e2bc..3d7f1a2369 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis_nvic.h +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/cmsis_nvic.h @@ -19,7 +19,7 @@ #define NVIC_NUM_VECTORS (16 + 102) -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) # define NVIC_RAM_VECTOR_ADDRESS ((uint32_t) &Image$$ER_IRAMVEC$$ZI$$Base) #elif defined(__ICCARM__) # pragma section = "IRAMVEC" diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c index b262af0704..a2c7189b8c 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c @@ -48,7 +48,7 @@ void FUN(void) __attribute__ ((weak, alias(#FUN_ALIAS))); /* Initialize segments */ -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit; extern void __main(void); #elif defined(__ICCARM__) @@ -181,7 +181,7 @@ WEAK_ALIAS_FUNC(TRNG_IRQHandler, Default_Handler) // 101: /* Vector table */ -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) __attribute__ ((section("RESET"))) const uint32_t __vector_handlers[] = { #elif defined(__ICCARM__) @@ -193,7 +193,7 @@ const uint32_t __vector_handlers[] = { #endif /* Configure Initial Stack Pointer, using linker-generated symbols */ -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) (uint32_t) &Image$$ARM_LIB_STACK$$ZI$$Limit, #elif defined(__ICCARM__) //(uint32_t) __sfe("CSTACK"), @@ -342,7 +342,7 @@ void Reset_Handler(void) */ SystemInit(); -#if defined(__CC_ARM) +#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) __main(); #elif defined(__ICCARM__) diff --git a/targets/targets.json b/targets/targets.json index aeef05d43f..6a0225a898 100755 --- a/targets/targets.json +++ b/targets/targets.json @@ -4294,7 +4294,7 @@ "default_toolchain": "GCC_ARM", "extra_labels": ["NUVOTON", "M2351", "M2351K1AAEES"], "is_disk_virtual": true, - "supported_toolchains": ["GCC_ARM", "IAR"], + "supported_toolchains": ["GCC_ARM", "IAR", "ARMC6"], "inherits": ["Target"], "device_has": ["LOWPOWERTIMER", "RTC", "INTERRUPTIN","PORTIN", "PORTINOUT", "PORTOUT", "SERIAL","SERIAL_ASYNCH", "SERIAL_FC", "STDIO_MESSAGES", "SLEEP"], "release_versions": ["5"]