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];