MC9S12DT256 : have problem to when set __stack=0x3FFF

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

MC9S12DT256 : have problem to when set __stack=0x3FFF

Jump to solution
734 Views
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

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

View solution in original post

0 Kudos
Reply
2 Replies
537 Views
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 Kudos
Reply
536 Views
lx
Contributor I

Thank you Lundin.

0 Kudos
Reply