Skip to content

Commit 80cb65e

Browse files
bulislaw0xc0170
authored andcommitted
Add more verbose RTOS error messages
1 parent a8229b5 commit 80cb65e

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

rtos/rtx5/mbed_rtx_handlers.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,37 @@ __NO_RETURN void osRtxIdleThread (void *argument)
3131
__NO_RETURN uint32_t osRtxErrorNotify (uint32_t code, void *object_id)
3232
{
3333
osThreadId_t tid = osThreadGetId();
34-
error("CMSIS-RTOS error status: 0x%X, task ID: 0x%X\n\r", code, tid);
34+
35+
switch (code) {
36+
case osRtxErrorStackUnderflow:
37+
// Stack underflow detected for thread (thread_id=object_id)
38+
error("CMSIS-RTOS error: Stack underflow (status: 0x%X, task ID: 0x%X, task name: %s)\n\r",
39+
code, object_id, osThreadGetName(object_id));
40+
break;
41+
case osRtxErrorISRQueueOverflow:
42+
// ISR Queue overflow detected when inserting object (object_id)
43+
error("CMSIS-RTOS error: ISR Queue overflow (status: 0x%X, task ID: 0x%X, object ID: 0x%X)\n\r",
44+
code, tid, object_id);
45+
break;
46+
case osRtxErrorTimerQueueOverflow:
47+
// User Timer Callback Queue overflow detected for timer (timer_id=object_id)
48+
error("CMSIS-RTOS error: User Timer Callback Queue overflow (status: 0x%X, task ID: 0x%X, timer ID: 0x%X)\n\r",
49+
code, tid, object_id);
50+
break;
51+
case osRtxErrorClibSpace:
52+
// Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
53+
error("CMSIS-RTOS error: STD C/C++ library libspace not available (status: 0x%X, task ID: 0x%X)\n\r",
54+
code, tid);
55+
break;
56+
case osRtxErrorClibMutex:
57+
// Standard C/C++ library mutex initialization failed
58+
error("CMSIS-RTOS error: STD C/C++ library mutex initialization failed (status: 0x%X, task ID: 0x%X)\n\r",
59+
code, tid);
60+
break;
61+
default:
62+
error("CMSIS-RTOS error: Unknown (status: 0x%X, task ID: 0x%X)\n\r", code, tid);
63+
break;
64+
}
3565

3666
/* That shouldn't be reached */
3767
for (;;) {}

0 commit comments

Comments
 (0)