#if defined(_HCS12_SERIALMON) /* for Monitor based software remap the RAM & EEPROM to adhere to EB386. Edit RAM and EEPROM sections in PRM file to match these. */ ___INITRG = 0x00; /* lock registers block to 0x0000 */ ___INITRM = 0x39; /* lock Ram to end at 0x3FFF */ ___INITEE = 0x09; /* lock EEPROM block to end at 0x0fff */#endif
But, i have the follwoing two questions on this,
1. Can anyone please tell me how to enable this Serial Monitor code to re-map the memory in the MCU.
2. And imagine if the Serial Monitor is enabled, and the initialization of registers (INITRG = 0x00, INITRM = 0x39, and INITEE = 0x09) has become effective, what will be the starting address for the RAM or what are the boundaries of RAM in the whole memory map.
According to the above snippset, it says the ending address of the RAM is 0x3FFF, and the total RAM size of this MCU is 4Kbytes, so the starting address will be 0x3000. (i.e. form 0x3000 to 0x3FFF = 4Kbytes)
Here, I am confused, why the INITRM was assigned 0x39 and why not 0x31...?? and what is the starting address of RAM if INITRM = 0x39; (Why the RAM11 bit of INITRM register has been assigned as 1).
Actually, I am pretty much confused with RAM11 bit, I referred to AN2881.pdf, it says...for example
if INITRM = 0x20; then RAM Boundary will be 0x2000 ~ 0x2FFF
if INITRM = 0x30; then RAM Boundary will be 0x3000 ~ 0x3FFF
so what will be the starting ddress format if we use RAM11 bit ...???
As I am not very experieced in this filed, all the help from you will be greatly helpful to me...
Thanks to you all in advance
INITRM = 0x31; /* RAM size : 4K , range : 0x3000 ~ 0x3FFF */...and configured my .prm file to have RAM size from 0x3000 to 0x3FFF.So, untill now there is no problem as I am using MC9S12D64. But recently i have changed my MCU from MC9S12D64 to MC9S12DG128. As you know, MC9S12DG128 has 8Kbyte of RAM which can be mappable to any 8Kbytes of total memory (I.e. from 0x0000 to 0xFFFF).
As MCU is changed and the RAM memory of new MCU is 8Kbyte, i have to change the INITRM value in my isr _EntryPoint() to 0x21 or 0x20 and i have to configure my .prm file to have RAM memory from 0x2000 to 0x3FFF.
But here i did a mistake, i changed my .prm file to have RAM memory from 0x2000 to 0x3FFF in the SECTIONS. But i forget to change the value that is assinged to INITRM register in my ISR (_EntryPoint()). It is same as previous value, i.e. INITRM = 0x31.That means, MCU tires to assign the RAM memory from 0x3000 to 0x4FFF(since RAMHAL bit dont have any effect for this MCU), which can not be acceptable for MC9S12DG128 as it has 8Kbyte RAM memory.
So, in this situation we generally expect the system should go to some malfunction or might expect to halt with illegal bp. But, there is no such of situation here. My system is working very fine even though i wrote 0x31 to INITRM register for MC9S12DG128 which is very very strange to me..