9s12XE ,how to allocate the RAM source for temporary variables when both cores  active.

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

9s12XE ,how to allocate the RAM source for temporary variables when both cores  active.

4,034 次查看
HUST
Contributor I
hi , is there someone to provide the details for me ?  can we read the info from the MAP file? thanks !
标签 (1)
标记 (1)
0 项奖励
回复
10 回复数

1,432 次查看
HUST
Contributor I
thanks a lot ,i got it!
0 项奖励
回复

1,432 次查看
HUST
Contributor I

hi ,all

thanks for any hints in advance!

MCU = XEG128, CW4.6, mutilink  debuger  for HCS12X/XE 

 

in prm file,i put the stack for xgate from  0xFD1000  throughout  0xFD12FF ;  

 

RAM_XGATE_STK = READ_WRITE 0xFD1000 TO 0xFD12FF ALIGN 2[1:1]; /* The stack is set by the XGATE compiler option -Cstv=D300 */

 

but in the debug mode, open the memory window, XGATE address: D000 ~D3000, i never watch the  stack area refresh the contents( all data are gray,never change to red) 

 

 something wrong with my setting or operation?

 

 and another issue is:  some local variables in XGATE_ISR_LIN() function, which should be stored in XGATE stack according to the xgate compiler spec ,  was allocated into the other data, i.e. CPU12_DATA  CPU12 memory space 0x29f0'L (should say "occupy“ , one breakpoint was set over the local variables in the XGATE_ISR_LIN function to confirm this point), and results in unexpected change of the CPU12_DATA , so would you please tell me how to find the root cause for this issue step by step? or what's the items i should check? 

 

if more info need, i will post it. 

 

thanks  

 

 

 

 

0 项奖励
回复

1,432 次查看
CrasyCat
Specialist III

Hello

 

Did you set the appropriate option -Cstv for  XGATE Compiler?

 

CrasyCat

0 项奖励
回复

1,432 次查看
HUST
Contributor I

yes done. in make file  

-Cstv  = 0xD300

0 项奖励
回复

1,432 次查看
HUST
Contributor I

thanks !

 

i would like to confirm one thing:

when one call-funtion happened, on the one hand, CPU will  store 10 bytes in stack,  on the other hand, the CPU will dynamically allocate the RAM resource for the temporary variables in the function, as mentioned ,do these temporary/local variables occupy  not  other ( non- ) paged ram but stack ? and the same to the XGATE?

0 项奖励
回复

1,432 次查看
stanish
NXP Employee
NXP Employee

HUST,

 

Not sure I completely understand your question.

 

The S12 core related temporary and local variables are all placed into the same stack as function parameters. (see the HC12 and XGATE compiler manual - section "Stack Frames" for more information about using the stacks) S12 core stack have to be placed in the non-paged RAM.

Xgate "emulate" stack pointer using general purpose register R7. The stack has to be located at different global addresses then S12 core stack. XGATE stack can be (and usually is) located in paged RAM area. XGATE Local Memory Map sees this range as linear (see a S12X datasheet -> "XGATE memory map Scheme").

 

Stanish
0 项奖励
回复

1,432 次查看
HUST
Contributor I

One local FAE from Freescale tell me , the local temporary variables are allocated into respective stack for CPU and XGATE, as we know , some function contains mass local temporary variables, hence, how to guarantee the enough Stack/Heap size for all time ? Especially while seven levels interrupt nested?

 

thanks  


0 项奖励
回复

1,432 次查看
CrasyCat
Specialist III

Hello

 

There is no tool available to statically estimate the memory requirement on the stack.

What you can do is fill the stacks with a fill pattern and let the application run for some time.

 

Then check how much stack is used.

 

Alternatively you can set a watchpoint on the top of stack. If there is a stack overflow application will stop.

 

Note that you can only define 2 watchpoints at a time while debugging on real hardware.

 

CrasyCat

0 项奖励
回复

1,432 次查看
CrasyCat
Specialist III

Hello

 

I do not understand the question here.

Can you please be more specific and explain what is your problem?

 

CrasyCat

 

0 项奖励
回复

1,432 次查看
J2MEJediMaster
Specialist I

Look the the demo programs that came with the installations. One of them has a demo where the HCS12 core and XCore share data.

 

---Tom

 

0 项奖励
回复