AnsweredAssumed Answered

How to determine the task Stack size

Question asked by David XY Zhou on Dec 5, 2016
Latest reply on Dec 6, 2016 by David XY Zhou

Hi,

I have K60 tower board, and am using Code Warrior 10.6.4 with MQX 4.2.

 

I have only two tasks.

TASK_TEMPLATE_STRUCT  MQX_template_list[] =
{
{ UART_TASK,     Uart_Task,  20000,   5,    "Uart", MQX_AUTO_START_TASK,     0,         0 },
{ MAIN_TASK,       Main_Task,  25000,   6, "Main", MQX_AUTO_START_TASK,       0,        0 },
{ 0 }
};
 

And I have increased stack size to 25000 for Main task. It still triggers stack overflow. I am wandering how to determine the stack size for safety of not getting overflowed. Is there anyway to optimize the code for smaller stack size?

 

Thank you,

David Zhou

Outcomes