We are using TI OTA_Lib to implement firmware updates on device with CC3220SF (MODASF to be precise). As we want in some cases to use updates from SD card rather then download form web, we are bypassing part of OTA_Lib interface and using OTA_Archive directly.
Our app does following:
1. OTA_init is called
2. We are using exporting value of OtaLib_t *pOtaLib from OtaLib.c
3. Chunk by chunk data from update.tar on SD card is sent to OtaArchive_process using (&pOtaLib->OtaArchive) as first argument.
4. After reboot and OTA_init OTA_get with EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT used to check whether there is pending commit or not and after that rollback or commit new image.
Usually it works good, but if update is interrupted (we are simulating power loss) during unpacking of root or intermediate certificate, all consequent update attempts will fail: OtaArchive_process will return ARCHIVE_STATUS_ERROR_CLOSE_FILE and following log will be printed to log:
OtaArchive_RunParseTar: error on pCloseFile, Status=-10288
OtaArchive_Rollback: ERROR sl_FsCtl, Status=-10282
Devices that lock up in the field because of power loss is not something we want. Maybe there is some way to recover device after such failure or way to prevent this?