We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
My ARM7 software is using the RT environment of RL-ARM.
After adding a new tiny task Task8 to the previous 7 tasks, "os_stk_overflow" is called with the "task_id" pointing to Task8.
- Reducing the amount of code in Task 8 does not fix it (I reduced it to a simple for{;;} - loop)
- Increasing the task stack size in "RTX_conf.c" does not fix it.
- Changing the creation order of the tasks, i.e. calling os_tsk_create(task8) before os_tsk_create(task7), does fix it ("os_stk_overflow" is not called anymore)
So what are the other reasons beside a stack issue that is calling the "os_stk_overflow"?
Reducing the code size in general does not help, however reducing the local variables does. Maybe you have an array or a big structure declared in Task8.
The stack overflow detection is not a 100% reliable, it might also fail. This is because the Stack Pointer and a signature value are checked on a task switch.
Check local variables for all of your tasks and move big structures and arrays to global. This will not change the RAM requirements, but will avoid such problems that you have.
Most likely one of the other 7 tasks is over writing a section of memory that includes the signature portion of task8’s stack. Changing the order of creation is changing the location that is being over written.