|ARM Technical Support Knowledge Articles|
Applies to: Advanced RTOS
Information in this article applies to:
We are running a system that is using Advanced RTX166. Our system has several interrupt functions with different priorities running in the background. The system works correct, but sometimes (after a few hours) it crashes. With the TRAP debug function we determined that we have two different origins: STKOF and ILLOPA.
Do you have an explanation for this misbehaviour?
STKOF TRAP may happen on nested interrupts when the system stack is too small. Each interrupt saves some data on the system stack. On nested interrupts (low priority interrupt function is interrupted by high priority interrupt function) the system stack is heavily loaded. Such cases may be very rare and that is why you receive STKOF trap randomly after the system is running for a few hours. Increasing the system stack should help to solve this problem.
You may also enable the C166 compiler option Options for Target - C166 - Save Temporary Variables on User Stack which reduces the usage of the system stack.
ILLOPA TRAP may happen when the user stack is too small. The chance to run out of user stack is high when you are using local arrays or big local structs. If the user stack is too small it may cause wrong pointer values which could overwrite the TCB (task control block). The user stack is separate for each task and this is the reason why you see the problem in the os_switch_task() function.
Interrupt functions also use the user stack of the current active task and may require extra space on the user stack. Increasing the size of the user stack for all tasks in the AR166_Config.c configuration file should help to solve this problem.
Article last edited on: 2005-05-09 17:15:37
Did you find this article helpful? Yes No
How can we improve this article?