Hello, Dr. Ladislav.
Thank you very much for your answer. We fixed MMCCTL and we were already using -D__FARDATA, but the problem persists. We noticed something important. GPAGE is not being incremented automatically by compiler as we increment a variable. We are sure that this is the issue.
For instance, if we have a variable with an address 0x20FFFF and we increment it goes to 0x200000 instead of reaching 0x210000. We disassembled the code and we notice that CPU is using GPAGE and IX to generate 0x20FFFF external RAM address.
If the address variable is assigned to 0x20FFFE, GPAGE = 0x20 and IX = 0xFFFE (everything OK! external memory is reachable).
If the variable is incremented it goes to 0x20FFFF as expected, GPAGE = 0x20 and IX = 0xFFFF (OK!).
However, if we increment again to 0x210000, GPAGE stays 0x20 (!?) and IX = 0xFFFF.
In case my explanation is not good enough, this is a very simple code to illustrate the issue.
volatile byte *far byteAddress = (volatile byte *far)0x20FFFF;
volatile byte *far byteAddress2 = (volatile byte *far)0x210000;
// This works!
byteAddress[0] = 0xAA;
if (*byteAddress == 0xAA) {
// OK <= Enters here
} else {
// Not OK
}
// if we increment byteAddress (byteAddress++) from 0x20FFFF to 0x210000 it goes to 0x200000 (?)
byteAddress++;
// This does not work
byteAddress[0] = 0xBB;
if (*byteAddress == 0xBB) {
// OK
} else {
// Not OK <= Enters here
}
// if we assign 0x210000, it works
// This works!
byteAddress2[0] = 0xAA;
if (*byteAddress2 == 0xAA) {
// OK <= Enters here
} else {
// Not OK
}
Why the compiler does not increment GPAGE automatically as it was used to do with PPAGE in S12 compiler?
Thanks in advance.
James