5 years, 4 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

5 years, 4 months ago.

I had a while ago the same question, see:

Georg Lerm
5 years, 4 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...

9 months 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.