2 of 3 people found this helpful
The bytes_received in OTA image header is updated every time a sector is written into the flash. This helps us to track the bytes that are copied to the staged area. If the bytes_received variable is updated in the RAM and not written back to flash, we might loose the status of total bytes received in case of power loss/connection loss.
I agree with the fact that a partial image will anyhow not allow us to do an OTA update but it helps to debug the ota2 feature.
One possible suggestion to overcome flash endurance is to not re-write the OTA2 image header everytime and keep on updating it in RAM. On completion of entire download i.e., when total bytes_received >= image_size, the OTA2 header can be written back to the sflash.