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
Solved! Go to Solution.
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.
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.
Thank you Lundin.