Skip to content

Commit 4fd0daf

Browse files
bulislawc1728p9
authored andcommitted
CMSIS/RTX: Allow overwriting mutex ops for ARMC
(cherry picked from commit b882548)
1 parent 1be672d commit 4fd0daf

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ __attribute__((section(".rodata"))) =
429429
0U,
430430
#endif
431431
{ &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U },
432-
{
432+
{
433433
// Memory Pools (Variable Block Size)
434434
#if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
435435
&os_thread_stack[0], sizeof(os_thread_stack),
@@ -462,7 +462,7 @@ __attribute__((section(".rodata"))) =
462462
#endif
463463
&os_mpi_thread,
464464
#else
465-
NULL,
465+
NULL,
466466
NULL,
467467
#endif
468468
#if (OS_TIMER_OBJ_MEM != 0)
@@ -545,7 +545,7 @@ __asm void os_cb_sections_wrapper (void) {
545545
EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK]
546546
EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK]
547547
EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK]
548-
548+
549549
AREA ||.rodata||, DATA, READONLY
550550
EXPORT os_cb_sections
551551
os_cb_sections
@@ -745,11 +745,12 @@ typedef void *mutex;
745745
//lint -e818 "Pointer 'm' could be declared as pointing to const"
746746

747747
// Initialize mutex
748+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
748749
__USED
750+
#endif
749751
int _mutex_initialize(mutex *m);
750-
int _mutex_initialize(mutex *m) {
752+
__WEAK int _mutex_initialize(mutex *m) {
751753
int result;
752-
753754
*m = osMutexNew(NULL);
754755
if (*m != NULL) {
755756
result = 1;
@@ -761,26 +762,32 @@ int _mutex_initialize(mutex *m) {
761762
}
762763

763764
// Acquire mutex
765+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
764766
__USED
765-
void _mutex_acquire(mutex *m);
767+
#endif
768+
__WEAK void _mutex_acquire(mutex *m);
766769
void _mutex_acquire(mutex *m) {
767770
if (os_kernel_is_active() != 0U) {
768771
(void)osMutexAcquire(*m, osWaitForever);
769772
}
770773
}
771774

772775
// Release mutex
776+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
773777
__USED
774-
void _mutex_release(mutex *m);
778+
#endif
779+
__WEAK void _mutex_release(mutex *m);
775780
void _mutex_release(mutex *m) {
776781
if (os_kernel_is_active() != 0U) {
777782
(void)osMutexRelease(*m);
778783
}
779784
}
780785

781786
// Free mutex
787+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
782788
__USED
783-
void _mutex_free(mutex *m);
789+
#endif
790+
__WEAK void _mutex_free(mutex *m);
784791
void _mutex_free(mutex *m) {
785792
(void)osMutexDelete(*m);
786793
}

0 commit comments

Comments
 (0)