I just obtained an example code from SW engineers. I am sharing it as it is including description below:
This demo can implement how to remap the Flash address to one specific RAM address, and how to config the overlay region.
Development Env:
Debug steps:
Hope it helps
Hi,
I am testing the memory overlay functionality for the S32K396. I have established the relationship between Mirrored Flash and RAM by using OMU.
#define EXAMPLE_SECTOR_4_ADDR (0x00400000U)
const uint32_t *Array4 = (uint32_t *)0x400000;
const uint32_t *Array4mirror = (uint32_t *)0x8400000;
uint32_t Value4 = 0;
uint32_t Value4mirror = 0;
......
for(i = 0; i<OMU_NUM_BYTES; i++)
{
omu_flash_program_5data[i] = 5;
}
Flash_WriteFun(Example_MemInstanceId, EXAMPLE_SECTOR_4_ADDR,omu_flash_program_5data, OMU_NUM_BYTES);
......
Value4 = Array4[10];
Value4mirror = Array4mirror[10];
......
OMU INIT and OMU Enable
......
Value4 = Array4[10];
Value4mirror = Array4mirror[10];
Regards!
I haven't tested it, but in the C module Omu_MappingTest.c, function Omu_MappingFun shows certain OMU test, so it should be possible to understand expected use.
Unfortunately, the data was not read from the original flash in the Omu_MappingTest.c program. I successfully read the ram value from the mirrored flash through the Omu_MappingTest.c program. But when I modified the program and tried to read the ram value from the original flash, the read value still did not change from the original flash value to the ram value, and the results were not as expected.
I think it is correct, it worked this way on predecessor platforms as well (MPC57xx) i.e.
original flash address = physical address
mirrored flash address = logical address
calibration (overlay) runs above logical address and what is actually what you see (if I understand it well) that is changing data in RAM leads in changing of data in logical flash address
Unfortunately I am not aware of any example. I am double checking it with designers, I will let you know as soon as possible.