The MCU we use is the MPC5744P. We are now doing the OTA function, which is to remotely update the controller's software through the T-box. Now the controller needs to have a rollback function. Do you have a recommended rollback solution?
The solution we hope is that flash is divided into two areas, A/B. When the program runs in the A area, the new program is updated to the B area, and when the controller is powered on again, the BootLoader switches the boot flag from the A area to the B area. When the program runs in the B area, the new program is updated to the A area. When the controller is powered on again, the BootLoader switches the boot flag from the B area to the A area. If the program update fails, the boot flag can be switched back to the old area to implement software rollback.
However, the problem with the above scheme is that after the software is compiled, the addresses of variables and functions are fixed. The same software, if compiled in the A area, the address must be located in the A area. If this software is updated to the B area at this time, it will definitely go wrong. So is there any way to solve this problem?