change Stack size

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

change Stack size

Jump to solution
1,108 Views
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

Labels (1)
0 Kudos
Reply
1 Solution
817 Views
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

View solution in original post

0 Kudos
Reply
2 Replies
817 Views
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 Kudos
Reply
818 Views
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 Kudos
Reply