Error Function
Some system error conditions can be detected during runtime. If RTX kernel detects a runtime error, it calls the os_error() runtime error function.
void os_error (U32 err_code) {
/* This function is called when a runtime error is detected. */
OS_TID err_task;
switch (err_code) {
case OS_ERR_STK_OVF:
/* Identify the task with stack overflow. */
err_task = isr_tsk_get();
break;
case OS_ERR_FIFO_OVF:
break;
case OS_ERR_MBX_OVF:
break;
}
for (;;);
}
The error code is passed to this function as a parameter err_code:
| Error Code | Description |
|---|
| OS_ERR_STK_OVF | The stack checking has detected a stack overflow for the currently running task. |
| OS_ERR_FIFO_OVF | The ISR FIFO Queue buffer overflow is detected. |
| OS_ERR_MBX_OVF | The mailbox overflow is detected for isr_mbx_send() function. |
The runtime error function must contain an infinite loop to prevent further program execution. You can use an emulator to step over infinite loop and trace into the code introducing a runtime error. For the overflow errors this means you need to increase the size of the object causing an overflow.
Related Knowledgebase Articles