how to access paged Flash addresses of MC9S12XEP100

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to access paged Flash addresses of MC9S12XEP100

623 Views
兜里揣caca
Contributor II

Hi:

My data is stored in the paged flash area, When I monitor this address 0xe08000, I set the PPAGE=0xe0, However, the program is running error, How should I set it or have another method?

///////////////////////////////////////////////////////////////

PAGE_E0       = READ_ONLY   DATA_FAR IBCC_FAR  0xE08000 TO 0xE0BFFF;

///////////////////////////////////////////////////////////////////////

0 Kudos
3 Replies

498 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

In this case, pointer is necessary. however __pptr is not available , because it will change PPAGE register too. We have to use __far instead. With "__far", GPAGE is modified, global address is potentially used but user needn't modify other code and prm file.

see attached demo code.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

498 Views
兜里揣caca
Contributor II

Thank you very much for your answer!

but , In your code, If I access the 0xC28000 address data, That's what I do

volatile unsigned long mybyte,test;
const unsigned long * __far myPpagePointer;

void main(void) {

  volatile int i = 0;
 
  myPpagePointer = &myBigArray_extra[0] ;
  mybyte=*myPpagePointer; 


  myPpagePointer = &myBigArray[0] ;
  mybyte=*myPpagePointer;


  for(;;)
  {
    mybyte=*myPpagePointer++;
    i++;

 test=(*(unsigned char *)(0xC28000));
  }
 
}

However, data is not available, If I want to get the data from this address, 

I want to retrieve data directly from the paging address

What should I do?

Have a great day!

0 Kudos

498 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

please note key word "__far" is a qualifier for global pointer. while 0xc2000 is a logical address, you need convert it to global address first with HCSXAddrMap. this tool is in your debugger menu "component", "open..."

pastedImage_1.png

 Besides, __far keyword is important to extend address to 3bytes.

Thus revise your code like this can fix your problem:

 test=(*(unsigned long * __far)(0x708000));


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos