The Watch Dog is disabled at startup, inside the INIT_Derivative function.
To sum up:
1. When the function is located in Flash without relocation to RAM at start-up, everything is OK:
- After a warm reset (pushing the Reset button on the TRK-MPC5606B demoboard), the boot occurs normally and the main() is reached
- After a cold reset (Unplugging the TRK-MPC5606B demoboard power cable, waiting a few seconds then plugging the power cable again), the boot occurs normally and the main() is reached
2. When the function is located in Flash with a relocation to RAM at start-up :
- After a warm reset (pushing the Reset button on the TRK-MPC5606B demoboard), the boot occurs normally and the main() is reached
- After a cold reset (Unplugging the TRK-MPC5606B demoboard power cable, waiting a few seconds then plugging the power cable again), the boot fails and the microcontroller resets indefinitely. The main() is never reached and the INIT_Derivative() function which disables the Watch Dog is called.
I do not understand why a cold reset causes the boot to fail in case of Flash code relocation to RAM.
You fill find attached the Ready-to use CodeWarrior 10.6 project for MPC5604B for a quick reproduction on the problem. The function we are trying to relocate from Flash to RAM is called "output_clock()" in driver folder files.
Best regards,
Romain