Skip to content

NEW TOOLCHAIN: Add the ARMC6 Compiler #4949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
98b4768
Initial toolchain class for ARMC6
theotherjimmy Sep 23, 2016
1fef555
Parse deps the same for GCC_ARM and ARMC6
theotherjimmy Aug 15, 2017
922bf1b
Update mbed OS to handle ARMC6 requirements
theotherjimmy Aug 17, 2017
15a9a03
Enable Compiling with ARMC6 across all targets
theotherjimmy Aug 17, 2017
e9d3166
Expose present get_compile_options API in Toolcahins
theotherjimmy Aug 21, 2017
06b0068
Genericify arm compiler exporter to versions 5 + 6
theotherjimmy Aug 21, 2017
f4b7d8b
Avoid forcing preprocessing
theotherjimmy Aug 22, 2017
cd4fd86
Correct Freescale + NXP compiler detection macros
theotherjimmy Aug 29, 2017
4da4c1f
Correct compiler switching in Nordic code
theotherjimmy Aug 29, 2017
b22a174
Correct semihosting check for ARMC6
theotherjimmy Aug 29, 2017
0b7a903
Enable many STM devices with ARMC6
theotherjimmy Aug 29, 2017
fb53eb6
Correct Silabs NVIC selection
theotherjimmy Aug 29, 2017
7554975
Compile source code for Maxim targets
theotherjimmy Aug 29, 2017
91afbce
Correct Nuvoton compiler detection logic
theotherjimmy Aug 30, 2017
4f3f0cc
Make Realtek link
theotherjimmy Aug 30, 2017
d3b33d7
Correct NRF SDK11 assembly
theotherjimmy Aug 30, 2017
d72f6db
Disable MULADDC assembly
theotherjimmy Aug 30, 2017
887d293
Check for support in ARMC6
theotherjimmy Aug 31, 2017
41a6197
Update mbed 2 discriminator
theotherjimmy Sep 1, 2017
d56c19f
Detect test skips with armc6
theotherjimmy Sep 7, 2017
8a9d79b
Add ARMC6 to supported matrix
theotherjimmy Sep 7, 2017
33113ae
Correct unity math for ARMC6
theotherjimmy Sep 11, 2017
23aafbf
Optimize space usage on builds
theotherjimmy Sep 11, 2017
32bd25e
Fix include file for ARMCC 6, should use cmsis_armclang.h
adbridge Sep 12, 2017
fec2346
add ARMC6 in supported compiler
Sep 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@

/* Integer data types */
#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && \
(__ICC8051__ == 0)) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
(__ICC8051__ == 0)) || defined(__CC_ARM) || \
(defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
defined(__IAR_SYSTEMS_ICC__)
#include <stdint.h>
#else
typedef signed char int8_t;
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/* Use LWIP error codes */
#define LWIP_PROVIDE_ERRNO

#if defined(__arm__) && defined(__ARMCC_VERSION)
#if defined(__arm__) && defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050)
/* Keil uVision4 tools */
#define PACK_STRUCT_BEGIN __packed
#define PACK_STRUCT_STRUCT
Expand Down
5 changes: 5 additions & 0 deletions features/frameworks/unity/unity/unity_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ typedef _US64 _U_SINT;
#endif
typedef UNITY_FLOAT_TYPE _UF;

#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#else

#ifndef isinf
#define isinf(n) (((1.0f / f_zero) == n) ? 1 : 0) || (((-1.0f / f_zero) == n) ? 1 : 0)
#define UNITY_FLOAT_NEEDS_ZERO
Expand All @@ -236,6 +239,8 @@ typedef UNITY_FLOAT_TYPE _UF;
#define isnan(n) ((n != n) ? 1 : 0)
#endif

#endif /* ARMC6 */

#ifndef isneg
#define isneg(n) ((n < 0.0f) ? 1 : 0)
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ typedef struct _ARM_CFSTORE_STATUS {
ARM_CFSTORE_HANDLE (__name) = (ARM_CFSTORE_HANDLE) (__name##_buf_cFsToRe); \
memset((__name##_buf_cFsToRe), 0, CFSTORE_HANDLE_BUFSIZE)

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

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

#if defined __MBED__ && defined __ICCARM__
#elif defined __MBED__ && defined TOOLCHAIN_IAR
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
/* note, memory barriers may be required in the following implementation */
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
Expand Down
35 changes: 35 additions & 0 deletions platform/mbed_retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
#include "platform/mbed_retarget.h"

#if defined(__ARMCC_VERSION)
# if __ARMCC_VERSION >= 6010050
# include <arm_compat.h>
# endif
# include <rt_sys.h>
# include <rt_misc.h>
# include <stdint.h>
# define PREFIX(x) _sys##x
# define OPEN_MAX _SYS_OPEN
# ifdef __MICROLIB
Expand Down Expand Up @@ -334,6 +339,16 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
#endif
}

#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
extern "C" void PREFIX(_exit)(int return_code) {
while(1) {}
}

extern "C" void _ttywrch(int ch) {
serial_putc(&stdio_uart, ch);
}
#endif

#if defined(__ICCARM__)
extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) {
#else
Expand Down Expand Up @@ -497,6 +512,26 @@ extern "C" long PREFIX(_flen)(FILEHANDLE fh) {
}
return size;
}

extern "C" char Image$$RW_IRAM1$$ZI$$Limit[];

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)
{
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
uint32_t sp_limit = __current_sp();

zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned

struct __initial_stackheap r;
r.heap_base = zi_limit;
r.heap_limit = sp_limit;
return r;
}

extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
return _mbed_user_setup_stackheap(R0, R1, R2, R3);
}

#endif


Expand Down
2 changes: 1 addition & 1 deletion platform/mbed_sdk_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void mbed_copy_nvic(void)

/* Toolchain specific main code */

#if defined (__CC_ARM)
#if defined (__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 5010060))

int $Super$$main(void);

Expand Down
2 changes: 1 addition & 1 deletion platform/mbed_semihost_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" {

#if DEVICE_SEMIHOST

#ifndef __CC_ARM
#if !defined(__CC_ARM) && !defined(__ARMCC_VERSION)

#if defined(__ICCARM__)
static inline int __semihost(int reason, const void *arg) {
Expand Down
9 changes: 7 additions & 2 deletions rtos/TARGET_CORTEX/mbed_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ osMutexAttr_t singleton_mutex_attr;
#if !defined(HEAP_START)
#if defined(__ICCARM__)
#error "Heap should already be defined for IAR"
#elif defined(__CC_ARM)
#elif defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
#define HEAP_START ((unsigned char*)Image$$RW_IRAM1$$ZI$$Limit)
#define HEAP_SIZE ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
Expand Down Expand Up @@ -330,7 +330,7 @@ void mbed_start_main(void)

/******************** Toolchain specific code ********************/

#if defined (__CC_ARM)
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))

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

/* Called by the C library */
void __rt_entry (void) {
Expand Down
2 changes: 1 addition & 1 deletion rtos/TARGET_CORTEX/mbed_rtx_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#define OS_DYNAMIC_MEM_SIZE 0

#if defined(__CC_ARM)
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
/* ARM toolchain uses up to 8 static mutexes, any further mutexes will be allocated on the heap. */
#define OS_MUTEX_OBJ_MEM 1
#define OS_MUTEX_NUM 8
Expand Down
8 changes: 8 additions & 0 deletions rtos/TARGET_CORTEX/rtx5/rtx_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ void *__user_perthread_libspace (void) {
typedef void *mutex;

// Initialize mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
#endif
int _mutex_initialize(mutex *m);
__WEAK int _mutex_initialize(mutex *m) {
*m = osMutexNew(NULL);
Expand All @@ -607,7 +609,9 @@ __WEAK int _mutex_initialize(mutex *m) {
}

// Acquire mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
#endif
void _mutex_acquire(mutex *m);
__WEAK void _mutex_acquire(mutex *m) {
if (os_kernel_is_active()) {
Expand All @@ -616,7 +620,9 @@ __WEAK void _mutex_acquire(mutex *m) {
}

// Release mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
#endif
void _mutex_release(mutex *m);
__WEAK void _mutex_release(mutex *m) {
if (os_kernel_is_active()) {
Expand All @@ -625,7 +631,9 @@ __WEAK void _mutex_release(mutex *m) {
}

// Free mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
#endif
void _mutex_free(mutex *m);
__WEAK void _mutex_free(mutex *m) {
osMutexDelete(*m);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading