MQX - Task Stack Size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX - Task Stack Size

Jump to solution
4,183 Views
Vijayaragavan
Contributor I

Hi Guyz,

 

       I am new to MQX RTOS and i am working on MQX 3.0(MCF52259 DemoKit).

how exactly can i set stack size when creating the task?.

can any one explain me regarding that?.

is there any way to find out with trial and error method?

if yes how?

 

Thanks

Vijayaragavan S

 

0 Kudos
1 Solution
1,081 Views
PetrL
NXP Employee
NXP Employee

Hi,

 

ensure that MQX_KERNEL_LOGGING is set to one in your user_config.h file and that "c:\Program Files\Freescale\Freescale MQX 3.6\mqx\source\klog\kl_stack.c" is compiled in you psp library.

 

Also is always better to use the latest MQX version (currently 3.6.2) . I think that stack usage check function was not included in the MQX 3.0.0.

 

Regards,

PetrL

View solution in original post

0 Kudos
5 Replies
1,081 Views
JuroV
NXP Employee
NXP Employee

You have 3 possibilities:

1) guess and exagurate to be sure that the size will never be overrun

2) analytically check the size of subsequent calls and their stack size; however- for large numbers of nested calls and their variations this is not trivial

3) do 1) and consequently use MQX TAD and look for stack usage, where the used column can tell you the max. watermark level of the stack.

0 Kudos
1,081 Views
Nouchi
Senior Contributor II

Hello,

 

You're right but TAD needs CW professional edition :smileysad:

I use kernel logging features, enable by  MQX_KERNEL_LOGGING and MQX_MONITOR_STACK (needs to compile MQX libraries),  then use _klog_show_stack_usage() in your application to output messages on stdout device, it gives an idea about stack memory consumption.

 

Emmanuel

0 Kudos
1,081 Views
javax
Contributor I

Hi every body

 

I am trying to catch a bug through ebabling MQX_KERNEL_LOGGING and MQX_MONITOR_STACK and use _klog_show_stack_usage() but I´'ve got this error message:

 

Link Error   : Undefined : "_klog_get_task_stack_usage"
Referenced from "spi2_task_Entry" in

Link Error   : Undefined : "_klog_show_stack_usage"
Referenced from "spi2_task_Entry" in

Link failed.

I appreciate any help

0 Kudos
1,082 Views
PetrL
NXP Employee
NXP Employee

Hi,

 

ensure that MQX_KERNEL_LOGGING is set to one in your user_config.h file and that "c:\Program Files\Freescale\Freescale MQX 3.6\mqx\source\klog\kl_stack.c" is compiled in you psp library.

 

Also is always better to use the latest MQX version (currently 3.6.2) . I think that stack usage check function was not included in the MQX 3.0.0.

 

Regards,

PetrL

0 Kudos
1,081 Views
javax
Contributor I

Thanks PetrL.

 

I carried out a whole MQX library recompilation and now klog functions are working.

 

Thanks again

 

 

0 Kudos