Skip to content

NEW TOOLCHAIN: Add the ARMC6 compiler #4905

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
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_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 @@ -177,18 +177,6 @@ typedef struct _ARM_CFSTORE_STATUS {
}while(0)
#endif

#if 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); \
__dmb(0xf); \
(__a_HaNdLe) = (__b_HaNdLe); \
__dmb(0xf); \
(__b_HaNdLe) = (__temp_HaNdLe); \
__dmb(0xf); \
}while(0)
#endif

#if 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 */
Expand Down
10 changes: 10 additions & 0 deletions platform/mbed_retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,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
9 changes: 7 additions & 2 deletions rtos/mbed_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,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 @@ -328,7 +328,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 @@ -400,7 +400,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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the ARMCC reference manual recommend setting __use_two_region_memory and __use_no_semihosting using this syntax? Its a bit odd seeing inline assembly outside the body of a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#else
#pragma import(__use_two_region_memory)
#endif

/* Called by the C library */
void __rt_entry (void) {
Expand Down
8 changes: 8 additions & 0 deletions rtos/rtx5/TARGET_CORTEX_M/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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked in ARM-software/CMSIS_5#213 (comment) whether CMSIS guys have some better way of doing that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bulislaw. It looks like they're staying until the CMSIS guys can find a better solution.

__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
2 changes: 1 addition & 1 deletion rtos/rtx5/mbed_rtx_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MK66FN2M0VLQ18
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MK82FN256CAx15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MKL27Z64VDA4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MKL43Z256VLH4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MKL82Z128VLH7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processor: MKW24D512VHA5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processor: MKW41Z512VHT4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MK22FN512CAP12
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MK24FN1M0CAJ12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ typedef enum _dma_request_source
** Start of section using anonymous unions
*/

#if defined(__ARMCC_VERSION)
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#elif defined(__ARMCC_VERSION)
#pragma push
#pragma anon_unions
#elif defined(__CWCC__)
Expand Down Expand Up @@ -12617,7 +12618,8 @@ typedef struct {
** End of section using anonymous unions
*/

#if defined(__ARMCC_VERSION)
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#elif defined(__ARMCC_VERSION)
#pragma pop
#elif defined(__CWCC__)
#pragma pop
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: MK64FN1M0CAJ12
Expand Down Expand Up @@ -122,4 +122,4 @@ LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; l
}
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
extern "C" {
#endif

#include <arm_compat.h>
#include <rt_misc.h>
#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef MBED_CMSIS_NVIC_H
#define MBED_CMSIS_NVIC_H

#if defined(__CC_ARM)
#if defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
extern uint32_t Image$$VECTOR_RAM$$Base[];
#define __VECTOR_RAM Image$$VECTOR_RAM$$Base
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void __assert_func(const char *file, int line, const char *func, const char *fai
void InstallIRQHandler(IRQn_Type irq, uint32_t irqHandler)
{
/* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */
#if defined(__CC_ARM)
#if defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
extern uint32_t Image$$VECTOR_ROM$$Base[];
extern uint32_t Image$$VECTOR_RAM$$Base[];
extern uint32_t Image$$RW_m_data$$Base[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: LPC54114J256BD64_cm4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
/*
** ###################################################################
** Processors: LPC54608J512BD208
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c

LR_IROM1 0x00003000 0x0004F000 { ; load region size_region
ER_IROM1 0x00003000 0x0004F000 { ; load address = execution address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2017, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2017, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; Scatter-Loading Description File
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, STMicroelectronics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! armcc -E
#! armclang -E --target=arm-arm-none-eabi -x c
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
Expand Down
Loading