Skip to content

Commit 7b42891

Browse files
authored
Merge pull request #4949 from theotherjimmy/feature-armc5+armc6
NEW TOOLCHAIN: Add the ARMC6 Compiler
2 parents 5e437fe + fec2346 commit 7b42891

File tree

194 files changed

+427
-6246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+427
-6246
lines changed

features/FEATURE_BLE/targets/TARGET_Maxim/exactLE/wsf/generic/wsf_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444

4545
/* Integer data types */
4646
#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && \
47-
(__ICC8051__ == 0)) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
47+
(__ICC8051__ == 0)) || defined(__CC_ARM) || \
48+
(defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
49+
defined(__IAR_SYSTEMS_ICC__)
4850
#include <stdint.h>
4951
#else
5052
typedef signed char int8_t;

features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/cc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
/* Use LWIP error codes */
5252
#define LWIP_PROVIDE_ERRNO
5353

54-
#if defined(__arm__) && defined(__ARMCC_VERSION)
54+
#if defined(__arm__) && defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050)
5555
/* Keil uVision4 tools */
5656
#define PACK_STRUCT_BEGIN __packed
5757
#define PACK_STRUCT_STRUCT

features/frameworks/unity/unity/unity_internals.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ typedef _US64 _U_SINT;
227227
#endif
228228
typedef UNITY_FLOAT_TYPE _UF;
229229

230+
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
231+
#else
232+
230233
#ifndef isinf
231234
#define isinf(n) (((1.0f / f_zero) == n) ? 1 : 0) || (((-1.0f / f_zero) == n) ? 1 : 0)
232235
#define UNITY_FLOAT_NEEDS_ZERO
@@ -236,6 +239,8 @@ typedef UNITY_FLOAT_TYPE _UF;
236239
#define isnan(n) ((n != n) ? 1 : 0)
237240
#endif
238241

242+
#endif /* ARMC6 */
243+
239244
#ifndef isneg
240245
#define isneg(n) ((n < 0.0f) ? 1 : 0)
241246
#endif

features/storage/FEATURE_STORAGE/cfstore/configuration-store/configuration_store.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ typedef struct _ARM_CFSTORE_STATUS {
165165
ARM_CFSTORE_HANDLE (__name) = (ARM_CFSTORE_HANDLE) (__name##_buf_cFsToRe); \
166166
memset((__name##_buf_cFsToRe), 0, CFSTORE_HANDLE_BUFSIZE)
167167

168-
#if defined __MBED__ && defined TOOLCHAIN_GCC_ARM
168+
#if defined __MBED__ && (defined TOOLCHAIN_GCC_ARM || defined TOOLCHAIN_ARMC6)
169169
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
170170
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
171171
do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \
@@ -175,9 +175,8 @@ typedef struct _ARM_CFSTORE_STATUS {
175175
(__b_HaNdLe) = (__temp_HaNdLe); \
176176
__asm volatile("" ::: "memory"); \
177177
}while(0)
178-
#endif
179178

180-
#if defined __MBED__ && defined TOOLCHAIN_ARM
179+
#elif defined __MBED__ && defined TOOLCHAIN_ARM
181180
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
182181
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
183182
do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \
@@ -187,9 +186,8 @@ typedef struct _ARM_CFSTORE_STATUS {
187186
(__b_HaNdLe) = (__temp_HaNdLe); \
188187
__dmb(0xf); \
189188
}while(0)
190-
#endif
191189

192-
#if defined __MBED__ && defined __ICCARM__
190+
#elif defined __MBED__ && defined TOOLCHAIN_IAR
193191
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
194192
/* note, memory barriers may be required in the following implementation */
195193
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \

platform/mbed_retarget.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
#include "platform/mbed_retarget.h"
3535

3636
#if defined(__ARMCC_VERSION)
37+
# if __ARMCC_VERSION >= 6010050
38+
# include <arm_compat.h>
39+
# endif
3740
# include <rt_sys.h>
41+
# include <rt_misc.h>
42+
# include <stdint.h>
3843
# define PREFIX(x) _sys##x
3944
# define OPEN_MAX _SYS_OPEN
4045
# ifdef __MICROLIB
@@ -334,6 +339,16 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
334339
#endif
335340
}
336341

342+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
343+
extern "C" void PREFIX(_exit)(int return_code) {
344+
while(1) {}
345+
}
346+
347+
extern "C" void _ttywrch(int ch) {
348+
serial_putc(&stdio_uart, ch);
349+
}
350+
#endif
351+
337352
#if defined(__ICCARM__)
338353
extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) {
339354
#else
@@ -497,6 +512,26 @@ extern "C" long PREFIX(_flen)(FILEHANDLE fh) {
497512
}
498513
return size;
499514
}
515+
516+
extern "C" char Image$$RW_IRAM1$$ZI$$Limit[];
517+
518+
extern "C" MBED_WEAK __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
519+
{
520+
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
521+
uint32_t sp_limit = __current_sp();
522+
523+
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
524+
525+
struct __initial_stackheap r;
526+
r.heap_base = zi_limit;
527+
r.heap_limit = sp_limit;
528+
return r;
529+
}
530+
531+
extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
532+
return _mbed_user_setup_stackheap(R0, R1, R2, R3);
533+
}
534+
500535
#endif
501536

502537

platform/mbed_sdk_boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void mbed_copy_nvic(void)
6767

6868
/* Toolchain specific main code */
6969

70-
#if defined (__CC_ARM)
70+
#if defined (__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 5010060))
7171

7272
int $Super$$main(void);
7373

platform/mbed_semihost_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern "C" {
2828

2929
#if DEVICE_SEMIHOST
3030

31-
#ifndef __CC_ARM
31+
#if !defined(__CC_ARM) && !defined(__ARMCC_VERSION)
3232

3333
#if defined(__ICCARM__)
3434
static inline int __semihost(int reason, const void *arg) {

rtos/TARGET_CORTEX/mbed_boot.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ osMutexAttr_t singleton_mutex_attr;
234234
#if !defined(HEAP_START)
235235
#if defined(__ICCARM__)
236236
#error "Heap should already be defined for IAR"
237-
#elif defined(__CC_ARM)
237+
#elif defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
238238
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
239239
#define HEAP_START ((unsigned char*)Image$$RW_IRAM1$$ZI$$Limit)
240240
#define HEAP_SIZE ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
@@ -330,7 +330,7 @@ void mbed_start_main(void)
330330

331331
/******************** Toolchain specific code ********************/
332332

333-
#if defined (__CC_ARM)
333+
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
334334

335335
/* Common for both ARMC and MICROLIB */
336336
int $Super$$main(void);
@@ -402,7 +402,12 @@ void pre_main (void)
402402
With the RTOS there is not only one stack above the heap, there are multiple
403403
stacks and some of them are underneath the heap pointer.
404404
*/
405+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
406+
__asm(".global __use_two_region_memory\n\t");
407+
__asm(".global __use_no_semihosting\n\t");
408+
#else
405409
#pragma import(__use_two_region_memory)
410+
#endif
406411

407412
/* Called by the C library */
408413
void __rt_entry (void) {

rtos/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
#define OS_DYNAMIC_MEM_SIZE 0
4343

44-
#if defined(__CC_ARM)
44+
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
4545
/* ARM toolchain uses up to 8 static mutexes, any further mutexes will be allocated on the heap. */
4646
#define OS_MUTEX_OBJ_MEM 1
4747
#define OS_MUTEX_NUM 8

rtos/TARGET_CORTEX/rtx5/rtx_lib.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ void *__user_perthread_libspace (void) {
595595
typedef void *mutex;
596596

597597
// Initialize mutex
598+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
598599
__USED
600+
#endif
599601
int _mutex_initialize(mutex *m);
600602
__WEAK int _mutex_initialize(mutex *m) {
601603
*m = osMutexNew(NULL);
@@ -607,7 +609,9 @@ __WEAK int _mutex_initialize(mutex *m) {
607609
}
608610

609611
// Acquire mutex
612+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
610613
__USED
614+
#endif
611615
void _mutex_acquire(mutex *m);
612616
__WEAK void _mutex_acquire(mutex *m) {
613617
if (os_kernel_is_active()) {
@@ -616,7 +620,9 @@ __WEAK void _mutex_acquire(mutex *m) {
616620
}
617621

618622
// Release mutex
623+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
619624
__USED
625+
#endif
620626
void _mutex_release(mutex *m);
621627
__WEAK void _mutex_release(mutex *m) {
622628
if (os_kernel_is_active()) {
@@ -625,7 +631,9 @@ __WEAK void _mutex_release(mutex *m) {
625631
}
626632

627633
// Free mutex
634+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
628635
__USED
636+
#endif
629637
void _mutex_free(mutex *m);
630638
__WEAK void _mutex_free(mutex *m) {
631639
osMutexDelete(*m);

targets/TARGET_ARM_SSG/TARGET_BEETLE/device/TOOLCHAIN_ARM_STD/sys.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/TOOLCHAIN_ARM_STD/sys.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAMD21G18A/device/TOOLCHAIN_ARM_MICRO/sys.cpp

Lines changed: 0 additions & 41 deletions
This file was deleted.

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAMD21G18A/device/TOOLCHAIN_ARM_STD/sys.cpp

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)