SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The M4 host application software can be updated as part of a bundle. The advantage of adding this file to a bundle is to keep the integrity of the entire system during update.
When the bundle is in the PENDING_COMMIT state, a hardware watchdog timer (WDT) is automatically activated (if configured in the mcubootinfo.bin). If the WDT expires, an automatic reboot is triggered and the bundle files are automatically rolled back.
When invoking the commit function, there are two options:
When invoking rollback (when the bundle is in the pending commit state), a clean reboot is required (PRCMHibernateCycleTrigger()).
To configure the WDT, set the mcubootinfo file.
The WDT resets (hibernate-reset) the system after two time-out events.
BootInfo.ulStartWdtTime is a 32-bit field that contains the number of clock ticks; because the WDT runs at 80 MHz, the maximum time-out possible is approximately (53 sec × 2)
Example of how to set the WDT for the CC32xx devices:
#define APPS_WDT_START_KEY 0xAE42DB15
typedef struct sBootInfo
{
_u8 ucActiveImg;
_u32 ulImgStatus;
_u32 ulStartWdtKey;
_u32 ulStartWdtTime;
}sBootInfo_t;
_sBootInfo_t sBootInfo;
_u32 MasterToken = 1234;
i32 FileHdl;
_i32 Status;
_i16 StatusClose;
//Open file "/sys/mcubootinfo.bin" for write
FileHdl = sl_FsOpen((unsigned char *)("/sys/mcubootinfo.bin",
SL_FS_CREATE|SL_FS_OVERWRITE |
SL_FS_CREATE_SECURE | SL_FS_CREATE_PUBLIC_WRITE |
SL_FS_CREATE_NOSIGNATURE | SL_FS_CREATE_VENDOR_TOKEN
SL_FS_CREATE_MAX_SIZE(sizeof(sBootInfo)), &MasterToken);
if(FileHdl < 0 )
{
/*error */
/* abort */
sl_FsClose(FileHdl,0,'A',1);
}
memset(&sBootInfo,0,sizeof(sBootInfo_t));
sBootInfo.ulStartWdtKey = APPS_WDT_START_KEY;
sBootInfo.ulStartWdtTime = 80000000;
Status = sl_FsWrite(FileHdl,0,(_u8*)&sBootInfo, sizeof(sBootInfo_t));
if( Status < 0 )
{
/*error */
}
StatusClose = sl_FsClose(FileHdl,0,0,0);
if( StatusClose < 0 )
{
/*error */
/* abort */
sl_FsClose(FileHdl,0,'A',1);
}