I am researching on how to remotely upgrade the firmware on the 52235 Coldfire. I have an external SPI flash capable of holding the full 256k of the code, so my steps would be:
1- load the new firmware into the external flash via the main program;
2- change the PC and/or reboot the micro in order to execute the bootloader/flashing utility which overwrites the internal flash (but not the bootloader);
3- change the PC again in order to have it pointing back to the main code (and reboot if necessary).
Having an external flash is convenient and safe because, even if the power fails during the internal flash erasing process, nothing is lost; the bootloader/flasher will simply restart the flashing operation at the next bootup. However, this poses a problem:
- when I change the code execution address from main program to flasher, I need to do it in a permanent way, so that, even if power fails, at next power-up the code running will be the flasher. Is there a way to change the starting execution address which is, I think, written in flash? If, in order to change it, I have to erase an entire page, the page must be dedicated solely to this function; is it possible?
- does anyone have a ready example for this operation? I mean either a working code or a pseudo-code example... can this be done in C or do I need assembler?
I hope I have been clear enough to explain the problem... if not, I will try and rephrase.
Thanks, best regards,