How well does CW handle external RAM on the MC9S12DP256 processor.
This processor only has a PPage registor on dpage therefor code and ram are handled by the same register. I have used the ICC compiler for my code in the past and it didnt handle external RAM at all. I therefore had to do special code to deal with it.
#define pLocation 0x4003
#define newpage 0x10
coldpage = PORTK;
PORTK = newpage;
asm("nop"); // as PORTK requires an extra clock cycle to change correctly
*(int*)pLocation := 34;
PORTK = cOldPage;
in the code worrier I have decleared the RAM as such
PAGE_10 = NO_INIT 0x104000 TO 0x107FFF;
PAGE_11 = READ_WRITE 0x114000 TO 0x117FFF;
PAGE_12 = READ_WRITE 0x124000 TO 0x127FFF;
PAGE_13 = READ_WRITE 0x134000 TO 0x137FFF;
PAGE_14 = READ_WRITE 0x144000 TO 0x147FFF;
BATTERY_RAM INTO PAGE_11,PAGE_12,PAGE_13,PAGE_14,PAGE_15,PAGE_16,PAGE_17,
PAGE_18,PAGE_19,PAGE_1A,PAGE_1B,PAGE_1C,PAGE_1D,PAGE_1E,PAGE_1F;
PROGRAM_RAM INTO PAGE_10;
#pragma DATA_SEG BATTERY_RAM
uchar pLocation;
#pragma DATA_SEG DEFAULT
pLocation = 34;
I am ok while the system is runnung but as soon as I turn the unit off the value is lost. The external memory is battery backed and it is working. As I can load my old Image craft code and it is stored.
Do I need to modify the datapage.c file so as when dealling with code it works on PORTK rather than the ppage register.