CodeWarrior local variable storage location

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

CodeWarrior local variable storage location

ソリューションへジャンプ
2,073件の閲覧回数
xaing_wang
Contributor I

In debug,I find that address of  local variable is not Stack。below the figure :

局部变量分配到ram区,并不是堆栈区.jpg

And the local variable define  in function  as follows:

uint8_t i = 0u , j = 0u;

The Ram and Stack define in mc9s12zvl32.prm as follows :

 RAM           = READ_WRITE  0x001100 TO 0x0013FF;

SHADOW_RAM    = READ_WRITE  0x001000 TO 0x001100;

So,I want to know how to define local variables are stored in the stack?

0 件の賞賛
返信
1 解決策
1,836件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Wang.

I just checked your project, but I haven't find stack problem.

As I said before, Stack address is inside the RAM section.

see your map file, we can know stack is allocated from address 0x1100 to 0x11ff.

while variable "i" and "j" are in this range.

pastedImage_1.png

Does this answer your questions?


Have a great day,
Jennie Zhang

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

元の投稿で解決策を見る

5 返答(返信)
1,836件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello.

Stack belongs to RAM section. Normally if you define a local variable, it should be automatically allocated in stack.

Can you please send me your demo project thus I can check your memory allocation from my side?


Have a great day,
Jennie Zhang

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

0 件の賞賛
返信
1,835件の閲覧回数
xaing_wang
Contributor I

Hello Jennie,

      I don't have your email,so,I uploaded to  Baidu SkyDrive demo project。

      tks。

0 件の賞賛
返信
1,837件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Wang.

I just checked your project, but I haven't find stack problem.

As I said before, Stack address is inside the RAM section.

see your map file, we can know stack is allocated from address 0x1100 to 0x11ff.

while variable "i" and "j" are in this range.

pastedImage_1.png

Does this answer your questions?


Have a great day,
Jennie Zhang

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

1,836件の閲覧回数
xaing_wang
Contributor I

Thank you Jennie。You are right.

I am mistaken "SHADOW_RAM  = READ_WRITE  0x001000 TO 0x001100;"   for  Stack.

By the way,How do I define stack location?such as in the end of RAM.

0 件の賞賛
返信
1,836件の閲覧回数
xaing_wang
Contributor I

http://pan.baidu.com/s/1c2Mjrvq   password:i5a7

0 件の賞賛
返信