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
Solved! Go to Solution.
Hi David:
I think you can use MQX tool, TAD (Task Aware Debugging).
There are TAD plugins for Code warrior, IAR, and Keil IDEs.
The plugins add MQX menu into your debugger environment and allow you to display various information about MQX OS kernel like stack usage per task, system memory pools etc.
You can start with a safe stack size , and fine tune it, try to decrease it a little each time, until the stack usage to 80-90% and no overflow, then I think the stack size is OK now.
Regards
Daniel
Hi David:
I think you can use MQX tool, TAD (Task Aware Debugging).
There are TAD plugins for Code warrior, IAR, and Keil IDEs.
The plugins add MQX menu into your debugger environment and allow you to display various information about MQX OS kernel like stack usage per task, system memory pools etc.
You can start with a safe stack size , and fine tune it, try to decrease it a little each time, until the stack usage to 80-90% and no overflow, then I think the stack size is OK now.
Regards
Daniel
Daniel,
Thank you. I will try TAD.
David Zhou