How to calculate the usage of STACK by IDE S32DS_ARM

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

How to calculate the usage of STACK by IDE S32DS_ARM

341件の閲覧回数
547416104
Contributor III

I  do not know how to calculate the usage of STACK, the IDE is S32DS_ARM. 

547416104_0-1677122170642.png

 

0 件の賞賛
1 返信

317件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @547416104 

well, there's no easy way how to calculate the usage of stack. One option is to use "high water mark" method: generally, you should use a debugger to fill the stack with some pattern (like 0xAA, for example) and then examine all possible operations/paths of your application. Then watch the stack in memory and check the address up to which was the patter rewritten. This should give a good clue what the size of stack should be.

Because the RAM is initialized in startup files in S32DS project due to ECC right after reset (all the RAM is set to "0"), you do not need to bother with filling of some pattern as it is already 0x00.

Another thing is that you can monitor the stack to guarantee that no overflow or underflow happened. This was already discussed:

https://community.nxp.com/t5/S32K/Example-of-DWT-for-stack-usage-monitoring-on-S32K1xx/m-p/1160990

https://community.nxp.com/t5/S32K/Failure-reaction-in-case-of-Stack-overflow-or-underflow-S32K1/m-p/...

https://community.nxp.com/t5/S32K/DWT-on-S32K11x/m-p/960401

Regards,

Lukas

0 件の賞賛