This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220S-LAUNCHXL: Deleted mcubootimg.bin file from UniFlash. How do I restore it?

Part Number: CC3220S-LAUNCHXL
Other Parts Discussed in Thread: UNIFLASH

By mistake I deleted the file mcubootimg.bin from under User Files in UniFlash.  How do I restore this file to the tool?  I need it to generate the hex file for a CC3220 device.  The file should appear next to mcuflashimg.bin

.

  • Correction.  The deleted file is mcubootinfo.bin.

  • The file is generated in the ota examples (as its structure contains the watchdog timeout to protect the test image following the OTA).

    You can run the OTA example to generate the file, or just run the following code in one of your example (and of course you can create the file based on the structure given).

    typedef struct sBootInfo
    {
        uint8_t ucActiveImg;
        uint32_t ulImgStatus;
        uint32_t ulStartWdtKey;
        uint32_t ulStartWdtTime;
    }sBootInfo_t;
    
    int32_t Platform_CommitWdtConfig(int32_t TimeoutInSeconds)
    {
    #ifdef CC32XX
        int32_t lFileHandle;
        uint32_t ulToken = 0;
        sBootInfo_t sBootInfo;
        int32_t lRetVal;
    
        lFileHandle = sl_FsOpen(
            (unsigned char *)"/sys/mcubootinfo.bin",
            SL_FS_CREATE | SL_FS_OVERWRITE |
            SL_FS_CREATE_MAX_SIZE(
                sizeof(sBootInfo)) |
            SL_FS_CREATE_SECURE | SL_FS_CREATE_PUBLIC_WRITE |
            SL_FS_CREATE_NOSIGNATURE,
            (_u32 *)&ulToken);
    
        if(0 > lFileHandle)
        {
            //OTA_DBG_PRINT("OtaWatchDog: Error opening bootinfo file
          //        : %d\n\r",lFileHandle);
            return(-1);
        }
    
        memset(&sBootInfo,0,sizeof(sBootInfo_t));
        /* max 104 seconds */
        sBootInfo.ulStartWdtTime = 40000000 * TimeoutInSeconds; 
        sBootInfo.ulStartWdtKey = APPS_WDT_START_KEY;
        lRetVal =
            sl_FsWrite(lFileHandle, 0, (uint8_t*)&sBootInfo, sizeof(sBootInfo_t));
        lRetVal = sl_FsClose(lFileHandle, 0, 0, 0);
        if(0 != lRetVal)
        {
            //OTA_DBG_PRINT("OtaWatchDog: Failed to close the bootinfo file");
            return(-1);
        }
    #endif
        //Enable WDT - done by PRCMCC3200MCUInit
        //HWREG(0x4402E188) |= 0x00000020;
        return(0);
    }

    and here is an example file: 

    mcubootinfo.bin

    br,

    Kobi