AnsweredAssumed Answered

Working with 9S12 RAM Pages

Question asked by John Dammeyer on Aug 14, 2014
Latest reply on Aug 19, 2014 by ZhangJennie

I'd like to be able to have the compiler use the 4K available from 0x1000 to 0x1FFF so that I have contiguous RAM from 0x1000 to 0x3FFF.  By default the data sheet says the RPAGE is set to 0xFD.  I can also expressly set that.

Is this the right way to tell the C compiler that I have a structure with 640 bytes in 0x1000 to 0x1FFF area?

 

The linker PLACEMENT section has

  PAGED_RAM           /* paged data accessed by CPU12 only */
                  

INTO  RAM_FD;

The command line for the C compiler has:

-D__FAR_DATA

Also

-CpRPAGE=0xFD

 

In the application file the variable is declared as follows:

#pragma DATA_SEG PAGED_RAM

TECNREC ACNPacket;

#pragma DATA_SEG DEFAULT

 

Stepping through the code a pointer to the variable is loaded with 0x1000 and the application appears to work.

 

Am I missing anything?  If I want to use two pages of RAM then what?  Will the compiler fill in a value for RPAGE?

If I want to access the data in an interrupt routine it's probably best to first save the RPAGE and expressly set it to FD if I use more than one page?

Thanks

John

Outcomes