Update mbed OS to handle ARMC6 requirements

pull/4949/head
Jimmy Brisson 2017-08-17 13:06:35 -05:00
parent 1fef5553b4
commit 922bf1b619
6 changed files with 30 additions and 9 deletions

View File

@ -51,7 +51,7 @@
/* Use LWIP error codes */ /* Use LWIP error codes */
#define LWIP_PROVIDE_ERRNO #define LWIP_PROVIDE_ERRNO
#if defined(__arm__) && defined(__ARMCC_VERSION) #if defined(__arm__) && defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050)
/* Keil uVision4 tools */ /* Keil uVision4 tools */
#define PACK_STRUCT_BEGIN __packed #define PACK_STRUCT_BEGIN __packed
#define PACK_STRUCT_STRUCT #define PACK_STRUCT_STRUCT

View File

@ -165,7 +165,7 @@ typedef struct _ARM_CFSTORE_STATUS {
ARM_CFSTORE_HANDLE (__name) = (ARM_CFSTORE_HANDLE) (__name##_buf_cFsToRe); \ ARM_CFSTORE_HANDLE (__name) = (ARM_CFSTORE_HANDLE) (__name##_buf_cFsToRe); \
memset((__name##_buf_cFsToRe), 0, CFSTORE_HANDLE_BUFSIZE) 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. */ /** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \ #define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \ do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \
@ -175,9 +175,8 @@ typedef struct _ARM_CFSTORE_STATUS {
(__b_HaNdLe) = (__temp_HaNdLe); \ (__b_HaNdLe) = (__temp_HaNdLe); \
__asm volatile("" ::: "memory"); \ __asm volatile("" ::: "memory"); \
}while(0) }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. */ /** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \ #define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \ do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \
@ -187,9 +186,8 @@ typedef struct _ARM_CFSTORE_STATUS {
(__b_HaNdLe) = (__temp_HaNdLe); \ (__b_HaNdLe) = (__temp_HaNdLe); \
__dmb(0xf); \ __dmb(0xf); \
}while(0) }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. */ /** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
/* note, memory barriers may be required in the following implementation */ /* note, memory barriers may be required in the following implementation */
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \ #define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \

View File

@ -334,6 +334,16 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
#endif #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__) #if defined(__ICCARM__)
extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) { extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) {
#else #else

View File

@ -234,7 +234,7 @@ osMutexAttr_t singleton_mutex_attr;
#if !defined(HEAP_START) #if !defined(HEAP_START)
#if defined(__ICCARM__) #if defined(__ICCARM__)
#error "Heap should already be defined for IAR" #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[]; extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
#define HEAP_START ((unsigned char*)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)) #define HEAP_SIZE ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
@ -330,7 +330,7 @@ void mbed_start_main(void)
/******************** Toolchain specific code ********************/ /******************** Toolchain specific code ********************/
#if defined (__CC_ARM) #if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
/* Common for both ARMC and MICROLIB */ /* Common for both ARMC and MICROLIB */
int $Super$$main(void); int $Super$$main(void);
@ -402,7 +402,12 @@ void pre_main (void)
With the RTOS there is not only one stack above the heap, there are multiple 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. 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) #pragma import(__use_two_region_memory)
#endif
/* Called by the C library */ /* Called by the C library */
void __rt_entry (void) { void __rt_entry (void) {

View File

@ -41,7 +41,7 @@
#define OS_DYNAMIC_MEM_SIZE 0 #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. */ /* 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_OBJ_MEM 1
#define OS_MUTEX_NUM 8 #define OS_MUTEX_NUM 8

View File

@ -595,7 +595,9 @@ void *__user_perthread_libspace (void) {
typedef void *mutex; typedef void *mutex;
// Initialize mutex // Initialize mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
#endif
int _mutex_initialize(mutex *m); int _mutex_initialize(mutex *m);
__WEAK int _mutex_initialize(mutex *m) { __WEAK int _mutex_initialize(mutex *m) {
*m = osMutexNew(NULL); *m = osMutexNew(NULL);
@ -607,7 +609,9 @@ __WEAK int _mutex_initialize(mutex *m) {
} }
// Acquire mutex // Acquire mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
#endif
void _mutex_acquire(mutex *m); void _mutex_acquire(mutex *m);
__WEAK void _mutex_acquire(mutex *m) { __WEAK void _mutex_acquire(mutex *m) {
if (os_kernel_is_active()) { if (os_kernel_is_active()) {
@ -616,7 +620,9 @@ __WEAK void _mutex_acquire(mutex *m) {
} }
// Release mutex // Release mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
#endif
void _mutex_release(mutex *m); void _mutex_release(mutex *m);
__WEAK void _mutex_release(mutex *m) { __WEAK void _mutex_release(mutex *m) {
if (os_kernel_is_active()) { if (os_kernel_is_active()) {
@ -625,7 +631,9 @@ __WEAK void _mutex_release(mutex *m) {
} }
// Free mutex // Free mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
#endif
void _mutex_free(mutex *m); void _mutex_free(mutex *m);
__WEAK void _mutex_free(mutex *m) { __WEAK void _mutex_free(mutex *m) {
osMutexDelete(*m); osMutexDelete(*m);