Hello,
I need somebody to explain this piece of code from the ota_update_os example, from the factoryResetTask:
//
// Read the boot Info
//
if( 0 == sl_FsOpen((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_READ,
&ulToken, &lFileHandle) )
{
if( 0 > sl_FsRead(lFileHandle, 0, (unsigned char *)&sBootInfo,
sizeof(sBootInfo_t)) )
{
while(1)
{
}
}
sl_FsClose(lFileHandle, 0, 0, 0);
}
Why is the while(1) there? The IMG_BOOT_INFO file is "/sys/mcubootinfo.bin. In case it is not readable I don't see stalling into the while(1) of any use. Or maybe the developer wanted to put some code inside the while(1) and forgot to do it? Also, if we are stalling there, why take care of closing the file? Or is there any condition in that project that may trigger a break from the while(1)?
Thanks and regards