32
32
extern void rtos_idle_loop (void );
33
33
extern void thread_terminate_hook (osThreadId_t id );
34
34
35
- __NO_RETURN void osRtxIdleThread (void * argument )
35
+ __NO_RETURN void osRtxIdleThread (void * argument )
36
36
{
37
37
for (;;) {
38
- rtos_idle_loop ();
38
+ rtos_idle_loop ();
39
39
}
40
40
}
41
41
42
- __NO_RETURN uint32_t osRtxErrorNotify (uint32_t code , void * object_id )
42
+ __NO_RETURN uint32_t osRtxErrorNotify (uint32_t code , void * object_id )
43
43
{
44
44
osThreadId_t tid = osThreadGetId ();
45
45
46
46
switch (code ) {
47
- case osRtxErrorStackUnderflow :
48
- // Stack underflow detected for thread (thread_id=object_id)
49
- // Note: "overflow" is printed instead of "underflow" due to end user familiarity with overflow errors
50
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_STACK_OVERFLOW ), "CMSIS-RTOS error: Stack overflow" , code );
51
- break ;
52
- case osRtxErrorISRQueueOverflow :
53
- // ISR Queue overflow detected when inserting object (object_id)
54
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_ISR_QUEUE_OVERFLOW ), "CMSIS-RTOS error: ISR Queue overflow" , code );
55
- break ;
56
- case osRtxErrorTimerQueueOverflow :
57
- // User Timer Callback Queue overflow detected for timer (timer_id=object_id)
58
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_TIMER_QUEUE_OVERFLOW ), "CMSIS-RTOS error: User Timer Callback Queue overflow" , code );
59
- break ;
60
- case osRtxErrorClibSpace :
61
- // Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
62
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_CLIB_SPACE_UNAVAILABLE ), "CMSIS-RTOS error: STD C/C++ library libspace not available" , code );
63
- break ;
64
- case osRtxErrorClibMutex :
65
- // Standard C/C++ library mutex initialization failed
66
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_CLIB_MUTEX_INIT_FAILURE ), "CMSIS-RTOS error: STD C/C++ library mutex initialization failed" , code );
67
- break ;
68
- default :
69
- //Unknown error flagged from kernel
70
- MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_UNKNOWN ), "CMSIS-RTOS error: Unknown" , code );
71
- break ;
47
+ case osRtxErrorStackUnderflow :
48
+ // Stack underflow detected for thread (thread_id=object_id)
49
+ // Note: "overflow" is printed instead of "underflow" due to end user familiarity with overflow errors
50
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_STACK_OVERFLOW ), "CMSIS-RTOS error: Stack overflow" , code );
51
+ break ;
52
+ case osRtxErrorISRQueueOverflow :
53
+ // ISR Queue overflow detected when inserting object (object_id)
54
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_ISR_QUEUE_OVERFLOW ), "CMSIS-RTOS error: ISR Queue overflow" , code );
55
+ break ;
56
+ case osRtxErrorTimerQueueOverflow :
57
+ // User Timer Callback Queue overflow detected for timer (timer_id=object_id)
58
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_TIMER_QUEUE_OVERFLOW ), "CMSIS-RTOS error: User Timer Callback Queue overflow" , code );
59
+ break ;
60
+ case osRtxErrorClibSpace :
61
+ // Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
62
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_CLIB_SPACE_UNAVAILABLE ), "CMSIS-RTOS error: STD C/C++ library libspace not available" , code );
63
+ break ;
64
+ case osRtxErrorClibMutex :
65
+ // Standard C/C++ library mutex initialization failed
66
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_CLIB_MUTEX_INIT_FAILURE ), "CMSIS-RTOS error: STD C/C++ library mutex initialization failed" , code );
67
+ break ;
68
+ default :
69
+ //Unknown error flagged from kernel
70
+ MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_KERNEL , MBED_ERROR_CODE_UNKNOWN ), "CMSIS-RTOS error: Unknown" , code );
71
+ break ;
72
72
}
73
73
74
74
/* That shouldn't be reached */
@@ -77,52 +77,52 @@ __NO_RETURN uint32_t osRtxErrorNotify (uint32_t code, void *object_id)
77
77
78
78
#if defined(MBED_TRAP_ERRORS_ENABLED ) && MBED_TRAP_ERRORS_ENABLED
79
79
80
- static const char * error_msg (int32_t status )
80
+ static const char * error_msg (int32_t status )
81
81
{
82
82
switch (status ) {
83
- case osError :
84
- return "Unspecified RTOS error" ;
85
- case osErrorTimeout :
86
- return "Operation not completed within the timeout period" ;
87
- case osErrorResource :
88
- return "Resource not available" ;
89
- case osErrorParameter :
90
- return "Parameter error" ;
91
- case osErrorNoMemory :
92
- return "System is out of memory" ;
93
- case osErrorISR :
94
- return "Not allowed in ISR context" ;
95
- default :
96
- return "Unknown" ;
83
+ case osError :
84
+ return "Unspecified RTOS error" ;
85
+ case osErrorTimeout :
86
+ return "Operation not completed within the timeout period" ;
87
+ case osErrorResource :
88
+ return "Resource not available" ;
89
+ case osErrorParameter :
90
+ return "Parameter error" ;
91
+ case osErrorNoMemory :
92
+ return "System is out of memory" ;
93
+ case osErrorISR :
94
+ return "Not allowed in ISR context" ;
95
+ default :
96
+ return "Unknown" ;
97
97
}
98
98
}
99
99
100
- void EvrRtxKernelError (int32_t status )
100
+ void EvrRtxKernelError (int32_t status )
101
101
{
102
102
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_EVENT ), error_msg (status ), status );
103
103
}
104
104
105
- void EvrRtxThreadError (osThreadId_t thread_id , int32_t status )
105
+ void EvrRtxThreadError (osThreadId_t thread_id , int32_t status )
106
106
{
107
107
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_THREAD_EVENT ), error_msg (status ), thread_id );
108
108
}
109
109
110
- void EvrRtxTimerError (osTimerId_t timer_id , int32_t status )
110
+ void EvrRtxTimerError (osTimerId_t timer_id , int32_t status )
111
111
{
112
112
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_TIMER_EVENT ), error_msg (status ), timer_id );
113
113
}
114
114
115
- void EvrRtxEventFlagsError (osEventFlagsId_t ef_id , int32_t status )
115
+ void EvrRtxEventFlagsError (osEventFlagsId_t ef_id , int32_t status )
116
116
{
117
117
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_EVENT_FLAGS_EVENT ), error_msg (status ), ef_id );
118
118
}
119
119
120
- void EvrRtxMutexError (osMutexId_t mutex_id , int32_t status )
120
+ void EvrRtxMutexError (osMutexId_t mutex_id , int32_t status )
121
121
{
122
122
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_MUTEX_EVENT ), error_msg (status ), mutex_id );
123
123
}
124
124
125
- void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id , int32_t status )
125
+ void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id , int32_t status )
126
126
{
127
127
// Ignore semaphore overflow, the count will saturate with a returned error
128
128
if (status == osRtxErrorSemaphoreCountLimit ) {
@@ -132,20 +132,20 @@ void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id, int32_t status)
132
132
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_SEMAPHORE_EVENT ), error_msg (status ), semaphore_id );
133
133
}
134
134
135
- void EvrRtxMemoryPoolError (osMemoryPoolId_t mp_id , int32_t status )
135
+ void EvrRtxMemoryPoolError (osMemoryPoolId_t mp_id , int32_t status )
136
136
{
137
137
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_MEMORY_POOL_EVENT ), error_msg (status ), mp_id );
138
138
}
139
139
140
- void EvrRtxMessageQueueError (osMessageQueueId_t mq_id , int32_t status )
140
+ void EvrRtxMessageQueueError (osMessageQueueId_t mq_id , int32_t status )
141
141
{
142
142
MBED_ERROR1 (MBED_MAKE_ERROR (MBED_MODULE_PLATFORM , MBED_ERROR_CODE_RTOS_MESSAGE_QUEUE_EVENT ), error_msg (status ), mq_id );
143
143
}
144
144
145
145
#endif
146
146
147
147
// RTX hook which gets called when a thread terminates, using the event function to call hook
148
- void EvrRtxThreadExit (void )
148
+ void EvrRtxThreadExit (void )
149
149
{
150
150
osThreadId_t thread_id = osThreadGetId ();
151
151
thread_terminate_hook (thread_id );
@@ -154,7 +154,7 @@ void EvrRtxThreadExit (void)
154
154
#endif
155
155
}
156
156
157
- void EvrRtxThreadTerminate (osThreadId_t thread_id )
157
+ void EvrRtxThreadTerminate (osThreadId_t thread_id )
158
158
{
159
159
thread_terminate_hook (thread_id );
160
160
#if (!defined(EVR_RTX_DISABLE ) && (OS_EVR_THREAD != 0 ) && !defined(EVR_RTX_THREAD_TERMINATE_DISABLE ) && defined(RTE_Compiler_EventRecorder ))
0 commit comments