If you want to update your MQX+application on fly, without the need for any external tool such as a BDM probe, you have the choice between these solutions :
- use a botloader : the bootloader is a minimal software stored in flash that is run first after each reset. By default its purpose is to boot your MQX+application also stored in flash (in the remaining space). When an update is needed, the user can stop at bootloader level (by pressing a key on serial console for example) and get a shell prompt from which a new MQX+application can be retrieved (from network for example) and burnt to flash overriting the current one.
The good point is that if power is removed while tne new image is update, the bootloader is still there and the update process can be done again to have a valid QX+application image. This is very safe.
However to do the update you need to physically connect to the local serial console, unless the bootloader allows a remote connection, and your application is down during this process
For this solution your can follow the link supplied by DavidS above.
- do without any bootloader and implement all the update software in your MQX+application. As your can not overrite the running image in flash, you need a buffer to store the new image while downloading; then once the image is in the buffer and has been fullly checked you run an update command that copy the buffer to the flash and reset the board.
The good point is that when your are downloading, your MQX+application is still running and you have all the MQX ressources available to download : FTP, TFTP, HTTP,... and can do that remotely connected to the board through a TELNET session (serial port console not mandatory).
The only drawback is that if the board is reset/powered-down while the final update command is running (takes few seconds) the board is dead with a broken software.
For this solution your can follow the linked I provided above.
Now when I speak about an external SPI flash for the second solution, this is to have all the internal flash available for the MQX+application image. The SPI flash is used as the buffer to store the downloaded image, and then this SPI flash is read-back by the update command copying its content to the internal flash. So you have to use the MQX SPI driver to write to the flash and have an update command supporting the read-back from this flash.
Without this external SPI flash, you have to use the second half of internal flash for the buffer, and then you only can use the first half of the internal flash for your MQX+application image. This is OK if your code is small enough but was not for me anymore.
My board has an MCF52259 (512Kbytes internal flash).
For the external SPI flash, I used an AT25DF041 (512KBytes).
Maybe I will post the modified buffer: driver and update command supporting this external SPI flash if some guys are interested.