Stack Size in TASK_TEMPLATE_STRUCT

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Stack Size in TASK_TEMPLATE_STRUCT

ソリューションへジャンプ
1,222件の閲覧回数
csmgsarma
Contributor IV

Hi List,

1. What is the need for stack size in this structure? Some RTOS flavors don't need this parameter.

2. How can a programmer choose his stack size optimally?

3. How can the stack usage be checked?

Regards

Sarma

タグ(2)
0 件の賞賛
返信
1 解決策
987件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Sarma:

1)  A proper configuration of the stack is essential to your system stability and reliability. If the stack size is too small, stack pointer might be moved out of the stack area thus an overflow situation occurs. In this case, the executing code could write to the area allocated  below the stack and lead to a serious runtime failure like overwritten variables, wild pointers, courrupted retrun address etc. On the other hand, setting the stack size too large means a waster of RAM resource which could be very limited in MCU-base embedded system.

I think you can google more for this topic.

2 & 3),MQX provided a tool , TAD (Task Aware Debugger) can analyze the stack usage.

Please read the below document for more details

C:\Freescale\Freescale_MQX_4_2\doc\tools\cw\MQX_RuntimeTAD_Getting_Started.pdf

please also check this thread for how to determine the task size

How to determine the task Stack size 

Best Regards

Daniel



-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
988件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Sarma:

1)  A proper configuration of the stack is essential to your system stability and reliability. If the stack size is too small, stack pointer might be moved out of the stack area thus an overflow situation occurs. In this case, the executing code could write to the area allocated  below the stack and lead to a serious runtime failure like overwritten variables, wild pointers, courrupted retrun address etc. On the other hand, setting the stack size too large means a waster of RAM resource which could be very limited in MCU-base embedded system.

I think you can google more for this topic.

2 & 3),MQX provided a tool , TAD (Task Aware Debugger) can analyze the stack usage.

Please read the below document for more details

C:\Freescale\Freescale_MQX_4_2\doc\tools\cw\MQX_RuntimeTAD_Getting_Started.pdf

please also check this thread for how to determine the task size

How to determine the task Stack size 

Best Regards

Daniel



-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信