Skip to content

Commit 3ef4650

Browse files
committed
Update mbed OS to handle ARMC6 requirements
1 parent 34d7f6c commit 3ef4650

File tree

6 files changed

+28
-17
lines changed

6 files changed

+28
-17
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: 1 addition & 13 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_ARM)
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); \
@@ -177,18 +177,6 @@ typedef struct _ARM_CFSTORE_STATUS {
177177
}while(0)
178178
#endif
179179

180-
#if defined __MBED__ && defined TOOLCHAIN_ARM
181-
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
182-
#define CFSTORE_HANDLE_SWAP(__a_HaNdLe, __b_HaNdLe) \
183-
do{ ARM_CFSTORE_HANDLE __temp_HaNdLe = (__a_HaNdLe); \
184-
__dmb(0xf); \
185-
(__a_HaNdLe) = (__b_HaNdLe); \
186-
__dmb(0xf); \
187-
(__b_HaNdLe) = (__temp_HaNdLe); \
188-
__dmb(0xf); \
189-
}while(0)
190-
#endif
191-
192180
#if defined __MBED__ && defined TOOLCHAIN_IAR
193181
/** @brief Helper macro to swap 2 handles, which is useful for the Find() idiom. */
194182
/* note, memory barriers may be required in the following implementation */

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/mbed_boot.c

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

329329
/******************** Toolchain specific code ********************/
330330

331-
#if defined (__CC_ARM)
331+
#if defined (__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
332332

333333
/* Common for both ARMC and MICROLIB */
334334
int $Super$$main(void);
@@ -400,7 +400,12 @@ void pre_main (void)
400400
With the RTOS there is not only one stack above the heap, there are multiple
401401
stacks and some of them are underneath the heap pointer.
402402
*/
403+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
404+
__asm(".global __use_two_region_memory\n\t");
405+
__asm(".global __use_no_semihosting\n\t");
406+
#else
403407
#pragma import(__use_two_region_memory)
408+
#endif
404409

405410
/* Called by the C library */
406411
void __rt_entry (void) {

rtos/rtx5/TARGET_CORTEX_M/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);

rtos/rtx5/mbed_rtx_conf.h

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

3939
#define OS_DYNAMIC_MEM_SIZE 0
4040

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

0 commit comments

Comments
 (0)