How can I copy paged flash data into RAM?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How can I copy paged flash data into RAM?

跳至解决方案
733 次查看
兜里揣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 项奖励
1 解答
486 次查看
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 项奖励
2 回复数
487 次查看
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 项奖励
486 次查看
兜里揣caca
Contributor II

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

0 项奖励