overlay RAM

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

overlay RAM

2,421 Views
金翅大鹏鸟
Contributor II

Hello!

I use the function of MPC5744P :this Flash read operation use mirror small Flash memory logical ddress(0x08F9_8000) with overlay.

//57xx_flasah.ld

MEMORY
{

flash_rchw : org = 0x01000000, len = 0x4
cpu0_reset_vec : org = 0x01000004, len = 0x4

Cal_Data_Flash : org = 0x00F98000, len = 16K /*its mirror Flash address is 0x08F9_0000 to 0x08F9_3FFF*/

m_text : org = 0x01000400, len = 2047K


m_data : org = 0x40000000, len = 368K

Cal_Data_RAM : org = 0x4005C000, len = 16K

local_dmem : org = 0x50800000, len = 64K
}

//57xx_ram.ld

MEMORY
{

SRAM : org = 0x40000000, len = 384K

local_dmem : org = 0x50800000, len = 64K
}

//code below:

#define CALIBRATION_SEG __attribute__ ((section(".CalRefPage")))

uint32_t CALIBRATION_SEG CalRefPara[20]={0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};

uint8_t CALIBRATION_SEG g_byCalData = 99;

uint8_t CALIBRATION_SEG g_byCalSaveKey = 12;

#define Calibration_Flash_Start_Addr 0x08F98000
#define Calibration_SRAM_Start_Addr 0x4005C000
#define Calibration_Remap_Size 0x4000

Calibration_RAM_CopyDown((uint32_t *)Calibration_Flash_Start_Addr,(uint32_t *)Calibration_SRAM_Start_Addr,Calibration_Remap_Size);

Flash_OverlayRAM_Calibration_Init();

//while(1) code below

Cal_Flash_Data_Read = *((uint32_t *)Calibration_Flash_Start_Addr);/*get the first calibration data stored on the mirror flash*/

Cal_Flash_Data_Read++;/*increase and write to the OverlyRAM*/
pWokPara = (uint32_t *)Calibration_SRAM_Start_Addr;
*pWokPara = Cal_Flash_Data_Read;

when I run the code,and stop at a time :

RAM memory area:  

address            0~3                   4~7              8~B             C~F

4005c000         0C67057A        00000000     00000001   00000002

...............          ............             .......  

mirror flash memory area:  

address            0~3                   4~7              8~B             C~F

08F98000         0C67057A        00000000     00000001   00000002

...............          ............             .......  

flash memory area:  

address            0~3                   4~7              8~B             C~F

00F98000         0C670000        00000000     00000001   00000002

...............          ............             .......  

Then how can I read the mirror flash data with gloabal variables(such as CalRefPara[0])?

or how can I write the data in mirror flash(0x08F98000~ 0x08F9BFFF) (or ram start at 0x4005c000) to flash memory(0x00F98000~ 0x00F9BFFF)?

code below is reading a global varible:

sJ1939Param.sEMU_MCU_FW3.uOutpMotinvtempact = CalRefPara[0];

Tags (1)
0 Kudos
Reply
4 Replies

2,043 Views
SivaValeo
Contributor I

Hello Both of you,

I am trying to implement Flash Overlay (remapping to SRAM) from 0x00FF0000 Flash memory region to 0x4001FF00 RAM of MPC5744P.
It is not working for me, then i have verified Data sheet, there i can see all the Flash regions are mentioned as "No Overlay".

I am referring this Document "MPC5744P Reference Manual, Rev. 6, 09/2015 ".

Could you explain me the concept behind this ?

i have attached the Register used below

PFLASH_PFCRCR = 0x00000011;
PFLASH_PFCRDE = 0x80000000;
PFLASH_PFCRD0_Word0 = 0x00FF0000;
PFLASH_PFCRD0_Word1 = 0x4001FF00;
PFLASH_PFCRD0_Word2 = 0xFFFF0005;

 

0 Kudos
Reply

2,343 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

you got expected result. When overlay is turned on, you can see the effect only in mirrored address space. Flash in normal address space is not affected by overlay. You will always read original data from normal address space. So, the calibration data should be read from mirrored address space. If the overlay is turned off, you will read original flash data, if it is turned on, you will read RAM data. Still from the same address (mirrored flash address). And if you want to update the calibration data in flash, normal flash needs to be reprogrammed by yourself.

Regards,

Lukas

0 Kudos
Reply

2,343 Views
金翅大鹏鸟
Contributor II

Hello!

If I want to get a varible such as CalRefPara[0](value changed from 12 to 100),How can I get the  changed value(100)? sJ1939Param.sEMU_MCU_FW3.uOutpMotinvtempact = CalRefPara[0]; The address of CalRefPara[0] is in original flash. Must I get the changed value at the RAM or mirror flash address?

0 Kudos
Reply

2,343 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

you need to read the value from mirrored flash address.

Regards,

Lukas

0 Kudos
Reply