AnsweredAssumed Answered

Paged ram/ far pointers CW S12X

Question asked by controls controls on Aug 17, 2009
Latest reply on Mar 8, 2010 by kef

Hi all,

I'm having trouble understanding and utilising far pointers and various pages of ram. (i'm using chip S12XEP100)

 

I'm trying to make a custom secondary bootloader, and having the program in RAM, with default_ram (variables and that) and large buffer in PAGED ram. 

 

So i've mapped default_rom into ram; (0x2100 to 0x3900) (downloaded from a primary bootloader)

my_data_ram into PAGE_RAM_F0 (F01000 to F01FFF)

my_data into PAGE_RAM_F3 (F31000 to F31FFF)

 

I've then defined all my variables at page F0 using #pragma DATA_SEG __RPAGE_SEG MY_DATA_RAM

Which seems to work fine, and are happy together.

 

Now the issue is i want to copy data using pointers from one page to another, i.e. my_data into my_data_ram but looking at the debugger, it doesn't seem like RPAGE is changing in these conversions.

 

So trying to declare _far  *my_data_ptr doesn't seem to work, it just accesses RPAGE F0 data at the address rather than RPAGE F3

 

i've modified my far pointers to be in RPAGE F3 but that doesn't seem to do anything.

 

(is there a document/tutorial on how to use paged ram properly? am i missing something fundamental? can you copy data from one page to another easily?)

Outcomes