Skip to content

Commit 922bf1b

Browse files
committed
Update mbed OS to handle ARMC6 requirements
1 parent 1fef555 commit 922bf1b

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

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/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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,16 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
334334
#endif
335335
}
336336

337+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
338+
extern "C" void PREFIX(_exit)(int return_code) {
339+
while(1) {}
340+
}
341+
342+
extern "C" void _ttywrch(int ch) {
343+
serial_putc(&stdio_uart, ch);
344+
}
345+
#endif
346+
337347
#if defined(__ICCARM__)
338348
extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) {
339349
#else

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);

0 commit comments

Comments
 (0)