This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX stack management

I am using RTX 4.70 for a project on Cortex M-3. I have added some osXXX calls to the core RTX api.

I am finding that if I have 2 threads (in addition to main plus any timer thread or idle thread) and one is blocked on say an osDelay(), the other thread bombs when it enters kernel mode via a svc trap. I am seeing some form of stack smashing. If I increase OS_TSKCNT from 3 to 4, the problem goes away, but I fear I am postponing a later stack corruption, and that the extra TSK_CNT memory block is buying me some time.

Looking through the RTX4 sources, I am not quite sure whether each thread gets both its own thread mode stack, i.e. tracking PSP, AND its own handler mode stack, tracking MSP, or if there is a single kernel stack and ALL threads 'share it'. Surely for each thread to enter handler mode and exit from it, a dedicated handler mode stack space is needed.

I cannot quite fathom from RTX_Conf_CM.c which #define, if any, is supposed to let me 'increase my handler mode stack space'.

ANY help appreciated. I am using GCC toolchain on Linux, so I don't have an RTX-aware debugger alas. i think at this point that would be very useful.

Stu