I am preparing a piece of code for censoring/uncensoring MPC56xx device based on AN3787. The app note advises to program RCHW before doing anything with the shadow flash, so I wanted to double-check if my understanding is correct. I intend to modify the shadow flash with a code that runs from RAM, and is loaded at address 0x4000_0100.
In order to have a chance of restoring the device if anything goes wrong, I need to program a RCHW at location 0x0000_0000 of code flash. What would the correct value of the RCHW be?
- 0x015A_0000_4000_0000 - VLE bit set, reset vector points to beginning of RAM
- 0x015A_0000_4000_0100 - VLE bit set, reset vector points to where I actually load the code
Currently I have an application in Flash, and took a look into the RCHW. It's 0x015A_015A_0000_361C. It appears that the RHCW does not follow the format recommended by AN3787, because the second 4 bytes are not set to 0000.
Edit: If something goes wrong, and the shadow flash is erased without being reprogrammed, can I load the code in RAM via BAM, given that the RCHW is correct?
I only have one MCU, on which to test, and it's important for me to get it right the first time. I'll appreciate your advise.
Thanks