I am writings steps to do so, but it seems you just started this
Get bootloader code of the controller, you will need it to customize the code.
- your firmware (old) will download new firmware, copy it into an inactive area and it will set a flag and then it will perform a software reset.
- After reset, the bootloader will check flag if set it will copy the
new firmware from the inactive area to active area. So new firmware is
active now.
The reason why old firmware will download the new firmware is that we want to keep the bootloader code as minimum as possible. So, the application process the new firmware maybe by CRC check. And to upgrade the firmware OTA you need to verify that your new firmware is 100% correct otherwise a single bit error can cause severe problems.