Skip to content

Commit 1aab93a

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

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
@@ -461,7 +461,7 @@ __attribute__((section(".rodata"))) =
461461
0U,
462462
#endif
463463
{ &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U },
464-
{
464+
{
465465
// Memory Pools (Variable Block Size)
466466
#if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
467467
&os_thread_stack[0], sizeof(os_thread_stack),
@@ -494,7 +494,7 @@ __attribute__((section(".rodata"))) =
494494
#endif
495495
&os_mpi_thread,
496496
#else
497-
NULL,
497+
NULL,
498498
NULL,
499499
#endif
500500
#if (OS_TIMER_OBJ_MEM != 0)
@@ -577,7 +577,7 @@ __asm void os_cb_sections_wrapper (void) {
577577
EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK]
578578
EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK]
579579
EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK]
580-
580+
581581
AREA ||.rodata||, DATA, READONLY
582582
EXPORT os_cb_sections
583583
os_cb_sections
@@ -777,11 +777,12 @@ typedef void *mutex;
777777
//lint -e818 "Pointer 'm' could be declared as pointing to const"
778778

779779
// Initialize mutex
780+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
780781
__USED
782+
#endif
781783
int _mutex_initialize(mutex *m);
782-
int _mutex_initialize(mutex *m) {
784+
__WEAK int _mutex_initialize(mutex *m) {
783785
int result;
784-
785786
*m = osMutexNew(NULL);
786787
if (*m != NULL) {
787788
result = 1;
@@ -793,26 +794,32 @@ int _mutex_initialize(mutex *m) {
793794
}
794795

795796
// Acquire mutex
797+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
796798
__USED
797-
void _mutex_acquire(mutex *m);
799+
#endif
800+
__WEAK void _mutex_acquire(mutex *m);
798801
void _mutex_acquire(mutex *m) {
799802
if (os_kernel_is_active() != 0U) {
800803
(void)osMutexAcquire(*m, osWaitForever);
801804
}
802805
}
803806

804807
// Release mutex
808+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
805809
__USED
806-
void _mutex_release(mutex *m);
810+
#endif
811+
__WEAK void _mutex_release(mutex *m);
807812
void _mutex_release(mutex *m) {
808813
if (os_kernel_is_active() != 0U) {
809814
(void)osMutexRelease(*m);
810815
}
811816
}
812817

813818
// Free mutex
819+
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
814820
__USED
815-
void _mutex_free(mutex *m);
821+
#endif
822+
__WEAK void _mutex_free(mutex *m);
816823
void _mutex_free(mutex *m) {
817824
(void)osMutexDelete(*m);
818825
}

0 commit comments

Comments
 (0)