This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to decide the task stack size ?

Other Parts Discussed in Thread: SYSBIOS

I use the dynamic method to create tasks in SYS/BIOS 6_34_02_18.

But I don't know the stack size should I use.

So I use a predefined value.

In RTOS Object View I can see the stackPeak.

 

Does it mean that the value of stackPeak is enough for my task ?

Some tasks that was running is preempted by others, so they not run all the functions. Will stackPeak change in next time when the task runs all the functions?

  • Hi,


    I guess that the answers to your two questions are yes. In sysbios userguide sec. 3.5.3 Task Stack we have:


    "Each Task has its ownruntime stack for storing local variables as well as for further nesting of function calls.

    You can specify the stack size separately for each Task object when you create the Task object statically or dynamically.

    Each task stack must be large enough to handle both its normal function calls and two full interrupting Hwi contexts.
    ...
    Another way to find the correct stack size is to make the stack size large and then use Code Composer Studio software to find the stack size actually used.
    "
    Regards

  • Hello,

    You should definitely read the Task Stacks section of the UG that Johannes pointed out if you have not not done so already.

    It is possible for the stackPeak value to increase over time as more nested function calls context switches occur.

    Whitney