Dear expert:
I am doing MPC5744P Bootloader Project. I arrange low flash memory block2 , low flash memory block3 and high flash memory block 0 for bootloader . And the other flash memory blocks,starting from high flash memory block 1, for application. So , all the other high flash memory blocks need to be erased
However, when executing the Flash erase function, the kernel encounters an exception and the program stops.
In code, I set highBlockSelect = 0b111110; If I modify it, highBlockSelect = 0b000000, only erase the 256K flash blocks, no problem occurs. How to explain this phenomenon?
Hi @ChenBowen
See Table 5-4. in the reference manual. Here is beginning of the table:
Each flash block belongs to certain RWW (Read While Write) partition.
Or in other words, when program or erase operation is running on a partition, the code must run from another partition or from RAM.
If the code already runs from another partition or from RAM, it may be caused by interrupts when interrupt handler accesses that partition. In this case, it's necessary to either disable interrupts or make sure that it does not touch that partition.
Regards,
Lukas
How to make sure the interrupt handler does not touch that partition?
The interrupt handler needs to be placed to different partition and it should not call a function / it should not read a data which are placed in partition which is currently being modified by flash operation.
Regards,
Lukas
Thank you for your reply ! The code runs from another partition , but the flash erase function is called in interrupts.