CMSIS/RTX: Allow overwriting mutex ops for ARMC

pull/6273/head
Bartek Szatkowski 2017-10-18 11:29:48 -05:00
parent cc2e0517e1
commit b88254809e
1 changed files with 15 additions and 8 deletions

View File

@ -374,7 +374,7 @@ __attribute__((section(".rodata"))) =
0U, 0U,
#endif #endif
{ &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U }, { &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U },
{ {
// Memory Pools (Variable Block Size) // Memory Pools (Variable Block Size)
#if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0)) #if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
&os_thread_stack[0], sizeof(os_thread_stack), &os_thread_stack[0], sizeof(os_thread_stack),
@ -407,7 +407,7 @@ __attribute__((section(".rodata"))) =
#endif #endif
&os_mpi_thread, &os_mpi_thread,
#else #else
NULL, NULL,
NULL, NULL,
#endif #endif
#if (OS_TIMER_OBJ_MEM != 0) #if (OS_TIMER_OBJ_MEM != 0)
@ -490,7 +490,7 @@ __asm void os_cb_sections_wrapper (void) {
EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK] EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK]
EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK] EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK]
EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK] EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK]
AREA ||.rodata||, DATA, READONLY AREA ||.rodata||, DATA, READONLY
EXPORT os_cb_sections EXPORT os_cb_sections
os_cb_sections os_cb_sections
@ -676,11 +676,12 @@ typedef void *mutex;
//lint -e818 "Pointer 'm' could be declared as pointing to const" //lint -e818 "Pointer 'm' could be declared as pointing to const"
// Initialize mutex // Initialize mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
#endif
int _mutex_initialize(mutex *m); int _mutex_initialize(mutex *m);
int _mutex_initialize(mutex *m) { __WEAK int _mutex_initialize(mutex *m) {
int result; int result;
*m = osMutexNew(NULL); *m = osMutexNew(NULL);
if (*m != NULL) { if (*m != NULL) {
result = 1; result = 1;
@ -692,8 +693,10 @@ int _mutex_initialize(mutex *m) {
} }
// Acquire mutex // Acquire mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
void _mutex_acquire(mutex *m); #endif
__WEAK void _mutex_acquire(mutex *m);
void _mutex_acquire(mutex *m) { void _mutex_acquire(mutex *m) {
if (os_kernel_is_active() != 0U) { if (os_kernel_is_active() != 0U) {
(void)osMutexAcquire(*m, osWaitForever); (void)osMutexAcquire(*m, osWaitForever);
@ -701,8 +704,10 @@ void _mutex_acquire(mutex *m) {
} }
// Release mutex // Release mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
void _mutex_release(mutex *m); #endif
__WEAK void _mutex_release(mutex *m);
void _mutex_release(mutex *m) { void _mutex_release(mutex *m) {
if (os_kernel_is_active() != 0U) { if (os_kernel_is_active() != 0U) {
(void)osMutexRelease(*m); (void)osMutexRelease(*m);
@ -710,8 +715,10 @@ void _mutex_release(mutex *m) {
} }
// Free mutex // Free mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED __USED
void _mutex_free(mutex *m); #endif
__WEAK void _mutex_free(mutex *m);
void _mutex_free(mutex *m) { void _mutex_free(mutex *m) {
(void)osMutexDelete(*m); (void)osMutexDelete(*m);
} }