4 years, 11 months ago.

Stack size of tasks

Using the FRDM-KLZ25 board from Freescale.

I have noticed the stack size of a task defined in cmsis_os.h DEFAULT_STACK_SIZE is about 2kbytes. For a simple task this is a bit of an overkill.

Is there a way to determine the max stack needed for a task? I have used 128 bytes with no problem.

Task was flashing and LED with delay.

Thank you.

Question relating to:

Comment on this question

3 Answers

4 years, 11 months ago.

I had a while ago the same question, see:

Georg Lerm
4 years, 11 months ago.

Thank you Erik. Seems that with 2K stack per thread on a KL25Z 4 threads is about the limit. Main thread and 3 other...

3 months, 1 week ago.

Note that in Mbed OS 5 you can set stack sizes through the Mbed OS configuration system. See the documentation for more information.

To post an answer, please log in.