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.

[参考译文] CC3220SF:OTA API 显示所有成功但预期的固件/文件未执行

Guru**** 2341740 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1498665/cc3220sf-ota-apis-showing-all-successful-but-expected-firmware-bin-file-not-executing

器件型号:CC3220SF

工具/软件:

显示成功响应的 OTA API。 库中无错误。  

 Hash verification succeeded.
    Total archive file bytes 527132.
OtaArchive_RunParseTar: 2 files that are mentioned in the ota.cmd were saved
OtaArchive_RunParseTar: Downloading File Completed - Size=521500
OtaArchive_RunParseTar: parsing archive file header
OtaArchive_RunParseTar: skip block align  RecvBufLen=571, SkipAlignSize=228

substring => 

+QIRD: 1097


BufLen = 1097, tempHTTPRxBuff = 

OtaArchive_RunParseTar: parsing archive file header
OtaArchive_RunParseTar: End of archive...
_SaveOtaVersionFile: save version file also in the bundle, version=20250408142802
OTA_run: ---- Download file completed /STRTD1/20250408142802_CC3220SF_ota.tar
\

HttpClient_SendReq, pHttpReqBuf=>
POST /ota/api/DeviceStats/OTAStatus HTTP/1.1
Host: apps.orxa.io
Authorization: 
Content-Type: application/json
Content-Length:  159

{ "deviceId": "STRTD1", "InstallSuccess": 1, "oTA": "{Type: 3, status : Success, error: 3}", "oTALogs": "{  start counter: 536887296,  access errors: 60209 }"}



strlen((const char *)pHttpReqBuf) =>302


BufLen = 535, tempHTTPRxBuff = 
HTTP/1.1 200 OK
Server: nginx/1.26.3
Date: Tue, 08 Apr 2025 09:27:32 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 309
Connection: keep-alive
Expires: -1
Pragma: no-cache
Cache-Control: no-cache

[{"ProductId":65,"DeviceId":"STRTD1","PowerOnTime":null,"ResetCause":null,"Hardware":null,"SDCard":null,"Firmware":null,"OTA":"{Type: 3, status : Success, error: 3}","OTALogs":"{  start counter: 536887296,  access errors: 60209 }","CreatedBy":"OTAStatus","CreatedOn":"2025-04-08T14:57:32","InstallSuccess":1}]hÉ 
OtaRunStep: status from Ota_run: Download done, status = 104




OtaImageTestingAndReset: download done
OtaImageTestingAndReset: call sl_Stop to move the bundle totesting state
OtaImageTestingAndReset: reset the platform to test the newimage...

但更新后的固件未执行、它没有多次更改、确认/检查。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、

    这些打印输出(如 OtaImageTestingAndReset:)是您添加的内容还是应该出现在代码上?

    在任何情况下、下载完成后、应用程序负责测试新下载的映像、并在通过您定义的一些测试(例如连接到 AP、ping 服务器等)时提交该映像。

    您这样做了吗?

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如何测试下载的映像?
    它不会首先运行下载的映像。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    ///*****************************************************************************
    // *  @ Description   : This function moves the image to testing state and resets the MCU.
    // *
    // *  @ Arguments     : None
    // *
    // *  @ Return value  : None
    // *
    //*****************************************************************************/
    int32_t OtaImageTestingAndReset()
    {
        int32_t retVal;
    
        OTA_DBG_PRINT("\n\n\n\n");
        OTA_DBG_PRINT("OtaImageTestingAndReset: download done\r\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: call sl_Stop to move the bundle to"
            "testing state\r\n");
        sl_Stop(SL_STOP_TIMEOUT);
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: reset the platform to test the new"
            "image...\r\n");
        Platform_Reset();
    
        /* if we reach here, the platform does not support self reset */
        /* reset the NWP in order to test the new image */
        OTA_DBG_PRINT("\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: platform does not support self reset\r\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: reset the NWP to test the new image\r\n");
        OTA_DBG_PRINT("\n");
        retVal = InitSimplelink(ROLE_STA);
        /* The sl_Stop/Start will produce event APP_EVENT_STARTED */
        return(retVal);
    }
    
    void Platform_Reset()
    {
    #ifdef __MSP432P401R__
        MAP_ResetCtl_initiateSoftReset();
    #elif (CC32XX == 1)
    //#else
        /* Reset the MCU in order to test the bundle */
        MAP_PRCMHibernateCycleTrigger();
    //    PRCMMCUReset(TRUE); // comment on 23/12/2024
    #endif
    }

    这些就是打印件。 以下代码可以在附加的代码片段中看到。 (注意:SL_STOP_TIMEOUT = 250)

    下面是检查 isPendingCommit 标志的提交代码

    /*****************************************************************************
     *  @ Description   : This function checks if there is new image available for
     *                    commit and if new image is found it will commit the new
     *                    image and after restart the MCU will always start with new image.
     *
     *  @ Arguments     : None
     *
     *  @ Return value  : (0) on success and (-1) on error
     *
    *****************************************************************************/
    
    int32_t OtaCheckAndDoCommit()
    {
        int32_t isPendingCommit;
        int32_t isPendingCommit_len;
        int32_t Status;
    
        /* At this stage we have fully connected to the network (IPv4_Acquired) */
        /* If the MCU image is under test, the ImageCommit process will
        commit the new image and might reset the MCU */
        Status =
            OTA_get(EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT,
                    (int32_t *)&isPendingCommit_len,
                    (uint8_t *)&isPendingCommit);
        if(Status < 0)
        {
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: OTA_get ERROR on "
                "EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT, Status = %d\r\n",
                Status);
            return(-1);
        }
        else
        {
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: "
                "Status = %d\r\n",
                Status);
        }
    
        /* commit now because 1. the state is PENDING_COMMIT 2. there was successful
        wlan connection */
        if(isPendingCommit)
        {
            Status = OTA_set(EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, 0, NULL, 0);
            if(Status < 0)
            {
                OTA_DBG_PRINT(
                    "OtaCheckDoCommit: OTA_set ERROR on "
                    "EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, Status = %d\r\n",
                    Status);
                return(-1);
            }
            OTA_DBG_PRINT("\r\n");
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: OTA success, new image commited and "
                "currently run\n");
            OTA_DBG_PRINT("\r\n");
            memset(cErrorMessageBuffer, 0, sizeof(cErrorMessageBuffer));
            sprintf(cErrorMessageBuffer,"\r\n%d\t%s: OTA successful\r\n",__LINE__,__FUNCTION__);
            ERROR_LOG(cErrorMessageBuffer,MSG_RUNTIME);
            mb_BIT_status[0] = mb_BIT_status[0] | (1 << OTA_COMIT_DONE);
            /* Stop the commit WDT */
            Platform_CommitWdtStop();
        }
        else
        {
            mb_BIT_status[0] = mb_BIT_status[0] & ~(1 << OTA_COMIT_DONE);
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: "
                "isPendingCommit = %d\r\n",
                isPendingCommit);
        }
        return(0);
    }
    
    void Platform_CommitWdtStop()
    {
    #ifdef CC32XX
        PowerCC32XX_reset(PowerCC32XX_PERIPH_WDT);
    #endif
    }

     当发生此故障情况时、isPendingCommit 标志= 0。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    代码看起来正常、

    为了澄清一下、在 OTA 过程结束后、您甚至不会运行应用程序?

    还是旧应用程序正在运行?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    旧应用程序正在运行。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我明白了。

    OTA 映像中包含哪些内容?

    我假设应用代码是开头、可能也是其他文件?

    在挖掘之前、我要测试的是向映像添加一个新的用户文件并应用 OTA。

    然后、检查文件系统上是否存在新文件。

    我想排除一下 mcuimg。

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    观察 :我调用了一个函数来检查闪存中的文件列表。 之前和之后的操作。

    复位前:ota.dat 文件存在并设置了提交待处理标志;复位后:ota.dat 文件不存在

    补救措施 : 我认为国旗没有正确设置,我在 Platform_Reset ()之前实施了一个延迟。

    因此、在设置了提交待处理标志的复位后发现 ota.dat 文件存在。 OTA 正在工作。

    [注意:我使用了 sl_FsGetFileList ()函数,它列出了闪存中的文件并显示了存在的标志]

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    那么、通过这种缓解措施、它是有效的吗?

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的更新。