Hi,
We are using RTX with STM32 cortex M3.
We have a task crashing due to hard fault, in the os_mbx_wait function. We investigated the hard fault including compiling the RTX source code in the project. We found the program crash in the function rt_mbx_wait:
extern OS_RESULT rt_mbx_wait (OS_ID mail_box, void **message, U16 timeout);
Further investigation is showing that when os_mbx_wait is called and the service call is made, the stack contains the correct values, i.e. the arguments to the function : a global mailbox and a timeout value.
When we have the hard fault, we can see that the rt_mbx_wait gets executed, the message pointer and the timeout value are correct, but the mailbox value is no longer valid - its has changed from a global mailbox to 0x00000001 (always).
After we checked the trace data , of a correct running trace, and a hard fault trace, and we found that: In the correct running we see in the trace, we get: os_mbx_wait rt_mbx_wait os_mbx_wait rt_mbx_wait os_mbx_wait rt_mbx_wait ......
When we got the hard fault, we get: os_mbx_wait rt_mbx_wait os_mbx_wait rt_mbx_wait rt_mbx_wait - !!!!!!!!!!
we can see that the rt_mbx_wait was called without a os_mbx_call.
other helping information about our project: 1. we got the error, only when using mailbox timeout (20 msec) and not in tasks that using infinite timeout. 2. the hard fault is very rare. it happened only after hundreds and thousands calls. 3. we think that it has something with the context-switch. we have several tasks in out project, and when we lower the task priority below other massive work tasks, we didn't got the error. 4. we found a similar case without a solution here: http://www.keil.com/forum/18639/
Any thoughts?
Thanks,