How can I copy paged flash data into RAM?

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

How can I copy paged flash data into RAM?

Jump to solution
728 Views
兜里揣caca
Contributor II

Hi:

My data is stored in the paged flash area, If I want to copy the data to RAM, What shall I do?

I tried that:

RAM           = READ_WRITE  DATA_NEAR            0x2000  TO   0x3FFF ;

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

PAGE_E0       = READ_ONLY   DATA_FAR IBCC_FAR  0xE08000 TO 0xE0BFFF;

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

void CopyToRam(void){
char i;  
char *Ps, *Pd;
 Ps = (void *)0xe08000;  /or 0x780000;
 Pd = (void *)0x2000;
  for(i=0;i<100;i++)
      *Pd++ = *Ps++;
    }
}

But I failed,

What should I do?

0 Kudos
1 Solution
481 Views
lama
NXP TechSupport
NXP TechSupport

The issue is that CW uses a global access instructions for data. So I have prepared an example and also attached a memory map. Please search for "TIC support" keyword in the prm file.

if there is anything not clear do not hesitate to ask.

To simplify an example I have initialized an array in the flash space 0x4000 (global address 0x7F4000). I have also initialized a space in the ram and removed it from the compiler automatic placement. The space I will use for myself.

There is also another approach how to exclude ram space I want to use myself but I do not want to mix info here.

Please look into example code. There are three different approaches presented. I believe you will understand. If you does not then do not hesitate to ask.

The example is made for XEP100 but it is the same MCU with higher memory and few more peripherals.

Best regards,

Ladislav

View solution in original post

0 Kudos
2 Replies
482 Views
lama
NXP TechSupport
NXP TechSupport

The issue is that CW uses a global access instructions for data. So I have prepared an example and also attached a memory map. Please search for "TIC support" keyword in the prm file.

if there is anything not clear do not hesitate to ask.

To simplify an example I have initialized an array in the flash space 0x4000 (global address 0x7F4000). I have also initialized a space in the ram and removed it from the compiler automatic placement. The space I will use for myself.

There is also another approach how to exclude ram space I want to use myself but I do not want to mix info here.

Please look into example code. There are three different approaches presented. I believe you will understand. If you does not then do not hesitate to ask.

The example is made for XEP100 but it is the same MCU with higher memory and few more peripherals.

Best regards,

Ladislav

0 Kudos
481 Views
兜里揣caca
Contributor II

Thank you for your reply, and my problem has been solved!

0 Kudos