change Stack size

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

change Stack size

跳至解决方案
1,481 次查看
binukannur
Contributor III

Hai,

I have 40 KB code size in MC9S08DZ128 controller. The most of the actions taken place in ISR.

Is it  necessary to  change my stack size in codewarrior studio when Iam using more code in ISR?

It has 8KB RAM area but in default stack size is 0200H

标签 (1)
0 项奖励
回复
1 解答
1,190 次查看
stanish
NXP Employee
NXP Employee

Hello,

Since S08 architecture has limited set of CPU registers complex code that contains complex C expressions may cause CPU registers/temporary values are saved/restored to/form stack more often and this could also increase stack consumption. But as Fiona indicated most of stack space is consumed by local variables, interrupt context saving and nested subroutines calls.

There is a linker switch  "-StackConsumption" which may help you to estimate stack size required by your application.

For more information please see the MCU_Build_Tools_Reference_manual.pdf, Section "Stack Consumption Computation".

http://cache.freescale.com/files/soft_dev_tools/doc/ref_manual/Build_Tools_Utilities.pdf?fsrch=1&sr=...

Hope it helps.

Stan

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,190 次查看
TICS_Fiona
NXP Employee
NXP Employee

Hello Binu

The stack space is used for local variables and temporaries and storing callee saved registers according to the calling convention.  So whether you needs more stack size depends on the data size of local data and calling convention, not on code size.

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,191 次查看
stanish
NXP Employee
NXP Employee

Hello,

Since S08 architecture has limited set of CPU registers complex code that contains complex C expressions may cause CPU registers/temporary values are saved/restored to/form stack more often and this could also increase stack consumption. But as Fiona indicated most of stack space is consumed by local variables, interrupt context saving and nested subroutines calls.

There is a linker switch  "-StackConsumption" which may help you to estimate stack size required by your application.

For more information please see the MCU_Build_Tools_Reference_manual.pdf, Section "Stack Consumption Computation".

http://cache.freescale.com/files/soft_dev_tools/doc/ref_manual/Build_Tools_Utilities.pdf?fsrch=1&sr=...

Hope it helps.

Stan

0 项奖励
回复