I am testing the memory overlay functionality for the MPC5744P. I can get RAM overlay to work as expected:
static void Overlay(uint32_t word0, uint32_t word1, uint32_t word2, uint32_t descriptor)
{
PFLASH->PFCRD[descriptor].Word0 = word0; /* Logical address */
PFLASH->PFCRD[descriptor].Word1 = word1; /* Physical address */
PFLASH->PFCRD[descriptor].Word2 = word2; /* Enable remapping for individual masters, size of page */
PFLASH->PFCRDE |= (uint32_t)0x80000000 >> descriptor; /* Enable descriptor */
PFLASH->PFCRCR |= (PFLASH_PFCRCR_GRMEN_MASK + PFLASH_PFCRCR_IRMEN_MASK); /* Global Remap Enable */
//PFLASH->PFCRCR |= (PFLASH_PFCRCR_GRMEN_MASK); /* Global Remap Enable */
}
... in app...
Overlay(0x09100000, 0x40040000, 0xFFFF0007, 1);
*(uint32_t*)0x40040000 = 0xAABBCCDD;
*(uint32_t*)0x40040004 = 0x11223344;
...
When I attempt to do the same operation for mapping flash, I do the following:
...
Overlay(0x09140000, 0x01000000, 0xFFFF0007, 0);
...
Correct me if I am wrong, but I am under the impression by "default" 0x09000000 mirrors 0x01000000, but manipulating the overlay functionality in the PFLASH module allows a user to create a virtual address so to speak to point to a different region - such as I did successfully with the RAM overlay.
The issue I am seeing is the following:
After I call the "Overlay" routine, I get this:
I do not understand why 0x09140000 is not mirroring 0x01000000... It looks like "junk" data in the memory window for 0x09140000.
已解决! 转到解答。
MPC5744P device does not support flash over flash overlay (as it is on MPC5748G). Only flash remapping by SRAM is working with MPC5744P device.