MC9S12DT256 : have problem to when set __stack=0x3FFF

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

MC9S12DT256 : have problem to when set __stack=0x3FFF

跳至解决方案
1,217 次查看
lx
Contributor I

I am using MC9S12DT256MFUE. It supposes to have 12k RAM. But when I set __stack=0x3FFF, the stack was unable to update, i.e. when calling a sub-routine, the return address was not saved in the stack. The stack works if I set __stack=0x2FFF. Is there any other registers I need to initialize?

Thank you

标签 (1)
0 项奖励
回复
1 解答
1,019 次查看
Lundin
Senior Contributor IV

Yes, you might need to set the INITRM register, and possibly also INITRG and INITEE. These registers map the memory to certain addresses.Check the MMC part of the manual for details of how to set them.

 

There is a figure in the introduction chapter of the manual, displaying the default memory layout for the part out of reset. Registers, RAM and EEPROM may overlap. If that happens, registers take precedence over RAM, which takes precedence over EEPROM.

 

You should set INITRM, INITRG and INITEE immediately after setting the stack pointer, at the very beginning of your program.

 

Also make sure that the stack etc are properly mapped to the correct addresses. This is compiler-dependent. If you are using Codewarrior, this is done in the .prm file.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,020 次查看
Lundin
Senior Contributor IV

Yes, you might need to set the INITRM register, and possibly also INITRG and INITEE. These registers map the memory to certain addresses.Check the MMC part of the manual for details of how to set them.

 

There is a figure in the introduction chapter of the manual, displaying the default memory layout for the part out of reset. Registers, RAM and EEPROM may overlap. If that happens, registers take precedence over RAM, which takes precedence over EEPROM.

 

You should set INITRM, INITRG and INITEE immediately after setting the stack pointer, at the very beginning of your program.

 

Also make sure that the stack etc are properly mapped to the correct addresses. This is compiler-dependent. If you are using Codewarrior, this is done in the .prm file.

0 项奖励
回复
1,019 次查看
lx
Contributor I

Thank you Lundin.

0 项奖励
回复