From 4fd0daf9f59008b7abcabb08a11db7c37c33a5ef Mon Sep 17 00:00:00 2001 From: Bartek Szatkowski Date: Wed, 18 Oct 2017 11:29:48 -0500 Subject: [PATCH] CMSIS/RTX: Allow overwriting mutex ops for ARMC (cherry picked from commit b88254809eb626689c8aeb41304a308bf4e34a04) --- rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c index 376c3ba5b9..8fe704f80e 100644 --- a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c +++ b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c @@ -429,7 +429,7 @@ __attribute__((section(".rodata"))) = 0U, #endif { &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U }, - { + { // Memory Pools (Variable Block Size) #if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0)) &os_thread_stack[0], sizeof(os_thread_stack), @@ -462,7 +462,7 @@ __attribute__((section(".rodata"))) = #endif &os_mpi_thread, #else - NULL, + NULL, NULL, #endif #if (OS_TIMER_OBJ_MEM != 0) @@ -545,7 +545,7 @@ __asm void os_cb_sections_wrapper (void) { EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK] EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK] EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK] - + AREA ||.rodata||, DATA, READONLY EXPORT os_cb_sections os_cb_sections @@ -745,11 +745,12 @@ typedef void *mutex; //lint -e818 "Pointer 'm' could be declared as pointing to const" // Initialize mutex +#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050 __USED +#endif int _mutex_initialize(mutex *m); -int _mutex_initialize(mutex *m) { +__WEAK int _mutex_initialize(mutex *m) { int result; - *m = osMutexNew(NULL); if (*m != NULL) { result = 1; @@ -761,8 +762,10 @@ int _mutex_initialize(mutex *m) { } // Acquire mutex +#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050 __USED -void _mutex_acquire(mutex *m); +#endif +__WEAK void _mutex_acquire(mutex *m); void _mutex_acquire(mutex *m) { if (os_kernel_is_active() != 0U) { (void)osMutexAcquire(*m, osWaitForever); @@ -770,8 +773,10 @@ void _mutex_acquire(mutex *m) { } // Release mutex +#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050 __USED -void _mutex_release(mutex *m); +#endif +__WEAK void _mutex_release(mutex *m); void _mutex_release(mutex *m) { if (os_kernel_is_active() != 0U) { (void)osMutexRelease(*m); @@ -779,8 +784,10 @@ void _mutex_release(mutex *m) { } // Free mutex +#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050 __USED -void _mutex_free(mutex *m); +#endif +__WEAK void _mutex_free(mutex *m); void _mutex_free(mutex *m) { (void)osMutexDelete(*m); }