AnsweredAssumed Answered

Problems writing to paged ram on an HC12

Question asked by Colin Tilleman on Jun 22, 2009
Latest reply on Jun 22, 2009 by Colin Tilleman

I am a using CodeWarrior version 5.7.0 with an MC9S12XDP512 processor.

I am trying to reserve 3 pages of paged RAM (FA, FB and FC) that will be accessed only by using far pointers.  Basically I have a very basic file system that sequentially stores data to those pages of RAM and I want to be able to access that data later without it being overwritten.  Whenever i try to write to memory, the contents of the memory say they are undefined.


I have declared the start addresses of my file system like this:

INT16U *__far startAddress = (INT16U*__far) 0xFA1000;
INT16U *__far endAddress = (INT16U*__far) 0xFC1FFF;
INT16U *__far currentAddress;

The addresses of each page are in the .prm file like this:

RAM_FA        = READ_WRITE  0xFA1000 TO 0xFA1FFF ALIGN 2[1:1];
RAM_FB        = READ_WRITE  0xFB1000 TO 0xFB1FFF ALIGN 2[1:1];
RAM_FC        = READ_WRITE  0xFC1000 TO 0xFC1FFF ALIGN 2[1:1];


These 3 pages are reserved in this way:

 PAGED_RAM              /* paged data accessed by CPU12 only */

                     INTO   RAM_FC, RAM_FB, RAM_FA;


One page was reserved for the X-Gate processor:





                        INTO  RAM_F8;


This is how I am writing to memory and initializing the pointer:

  currentAddress = startAddress;   //initialize the currentaddress pointer to the beginning of page A

*currentAddress = variable;  //write data to the current address in ram


In the debugger it says that *currentAddress = undefined.  Any ideas why I can't write to paged RAM?