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.

CC3200 OTA Service Pack以及MCU Image示例

Other Parts Discussed in Thread: CC3200, CC2538, UNIFLASH

由于在官方的SDK里面使用的是dropbox做服务器来进行OTA升级,国内访问不了, 为了方便大家可以参考,下面是用国内的一个服务器来实现的OTA例程。

https://github.com/yhpan0613/SimpleLink-CC3200/releases/tag/cc3200_ota_servicepack_and_image_v1_0

这是整套的代码,是基于SDK 1.2.0的,例程的名称是ota_update_cn。

请注意在编译这个例程之前, simplelink_extlib/ota是需要重新编译的。

在服务器端的准备升级的MCU Image以及Service Pack根据协议要放在位置OTA/CC3200。待升级的文件列表以及它们的大小是存储在一个文件img.txt里面,文件格式如下:

      SP_SIGN:{f40_sys_servicepack.sig}

      SIGN_SIZE:{256}

      SERVICEPACK:{f43_sys_servicepack.ucf}

      SP_SIZE:{28236}

      MCU_IMG:{f80_sys_mcuimg.bin}

      MCU_SIZE:{36316}

冒号前面的字段是文件标识,后面的字段是文件名称, f是文件标识,后面的数字代表标识的含义如下:

  • 01 - The file is secured 
  • 02 - The file is secured with signature
  • 04 - The file is secured with certificate
  • 08 - Don't convert _sys_ into /sys/ for SFLASH 
  • 10 - Use external storage instead of SFLASH 
  • 20 - Reserved.
  • 40 - NWP should be reset after this download
  • 80 - MCU should be reset after this download

还有另外一个文件ver.txt, 里面存储的是MCU image和Service Pack存储的路径,格式如下:

“CDN_url”: http://SERVER_DOMAIN/OTA/CC3200/Vid01_Pid33_Ver18/,

Vid代表Vendor ID, Pid代表Product ID, Ver代表升级软件版本,OTA/CC3200目录下文件列表如下

Vid01_Pid33_Ver18下面文件列表如下:

      

 

sys_servicepack.sig代表service pack的签名文件,会存储在/sys/serverpack.sig。sys_servicepack.ucf是待升级的service pack文件,会存储在/sys/serverpack.ucf。sys_mcuimg.bin是待升级的MCU Image文件,会存储在/sys/mcuimg2.bin。在进行OTA前, /sys/mcuimg.bin需要烧录application_bootloader, /sys/mcuimg1.bin需要烧录当前运行的Image。当OTA升级结束后,application_bootloader将会加载mcuimg2去运行。然后在下一次OTA的时候,从云服务器上下载的Image会烧录到/sys/mcuimg1.bin,在设备重启后application bootloader会自动加载mcuimg1。

注意:服务器端的KeepAlive选项要设置成ON.

  • 强烈支持,期待你的后续!!!

  • 以上关于是关于OTA的状态,欢迎提出改进意见,亦或者如果觉得想共享代码也是非常的欢迎。

  • 你好,我想请问下ata_api.h下的#define OTASTAT_FILENAME "/sys/otastat.txt"      里面的"/sys/otastat.txt" 路径在哪里,是否需要修改?因为按上文中您分享的方法没有成功升级,而是 sl_extLib_OtaRun 一直返回-4,表示路径找不到。。

  • 这个是在本地写的,就是在CC3200 FLASH上的路径。能否把DEBUG_PRINT的开关打开,具体在哪个API返回的错误,给出更多的log来分析一下。

  • 这个项目工程是直接导入到CCS 里面吗?

  • 你这个项目工程是CCS的吗?

  • C:\Users\Administrator\Downloads\SimpleLink-CC3200-cc3200_ota_servicepack_and_image_v1_0\example\ota_update_cn

    你说直接用CCS 导入这个工程文件就可以了?

  • TI 工程师,你好:
    **** Build Finished ****
    Buildfile generation error occurred..
    Referenced project 'ti_rtos_config' does not exist in the workspace. Project 'ota_update_os' may not build as expected.
    Build stopped..

    导入CCS工程后,编译的时候,提示了这个报错,你知道是什么原因吗?

  • 从你的错误看是ti_rtos_config这个没有导入进去,你的ti_rtos_config, 你先把ti_rtos_config这个工程编译一下看看。

  • Yonghua您好:

    我们这边搭了一个自己的服务器,路径相同什么都相同,访问Img.txt和ver.txt直接返回其文本,访问Vid01_Pid33_Ver18/下的三个文件时是返回文件,但是出现错误解决不了,具体错误如下

    请问有服务器搭建的流程讲解吗?麻烦指导一下,谢谢~~

  • 你好,我做的CC2538的芯片,要做到空中升级节点BIN文件,需要把OTA server搬到网关上,需要LIUNX的工具源码,请问如何能获取到,万分感谢

  • 灌胶产品的EMC问题
  • Hi Pan:

    我按照您的demo操作,发现总是在下载f80_sys_mcuimg.bin到15840bytes时pWriteFile就会出错!服务端不管是用您的或我自己搭建的都一样的结果,但是service pack可以更新成功。使用Uniflash烧录的文件:/sys/mcuimg.bin加载application_bootloader.bin,/sys/mcuimg1.bin加载ota_update_os.bin

    请帮看下下面的log,问题出在哪里?谢谢!

     

     

                     *************************************************
                             CC3200 OTA Update Application
                     *************************************************

     

    App Version             : 0.0.0
    Nwp Version             : 2.8.0.0.31.1.4.0.1.1.0.3.37

    Wifi Status             : Connected to Jansen

    NTP Server              : dmz0.la-archdiocese.net
    NTP Server IP           : 209.151.225.100

    GTM Time                : Tue Aug 02 2017 06:56:12
    Local Time (+05:30)     : Tue Aug 02 2017 12:26:12

    OTA Update Status       : Press SW3 : Updates or SW2: Factory Reset

    sl_extLib_OtaRun: entry, state=0
    _ReadStatFile: ERROR in sl_FsOpen, status=-11
    sl_extLib_OtaRun: call OtaClient_ConnectServer OTA server=platform2.lancens.com
    OtaClient_ConnectServer: http_connect_server platform2.lancens.com

    sl_extLib_OtaRun: entry, state=1
    sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid01_Pid00_Ver0000
    Recv len:438 -- buf:HTTP/1.1 200 OK
    Date: Tue, 01 Aug 2017 06:56:15 GMT
    Server: Apache/2.4.18 (Ubuntu)
    Last-Modified: Fri, 28 Jul 2017 02:34:29 GMT
    ETag: "9a-5555785456d57"
    Accept-Ranges: bytes
    Content-Length: 154
    Vary: Accept-Encoding
    Access-Control-Allow-Origin: *
    Content-Type: text/plain

    SP_SIGN:{f40_sys_servicepack.sig}
    SIGN_SIZE:{256}
    SERVICEPACK:{f43_sys_servicepack.ucf}
    SP_SIZE:{31348}
    MCU_IMG:{f80_sys_mcuimg.bin}
    MCU_SIZE:{53608}--
    Service Pack Signature: f40_sys_servicepack.sig and its size: 256
    Service Pack Name: f43_sys_servicepack.ucf and its size: 31348
    MCU IMAGE Name: f80_sys_mcuimg.bin and its size: 53608
    sl_extLib_OtaRun: OtaClient_UpdateCheck, numUpdates=3

    sl_extLib_OtaRun: entry, state=2
    sl_extLib_OtaRun: OtaClient_GetNextUpdate: file=f40_sys_servicepack.sig, size=256
    OtaClient_ResourceMetadata: call http_build_request /OTA/CC3200/ver.txt
    OtaClient_ResourceMetadata: file flags=40,metadata flags=40
    OtaClient_ResourceMetadata: file=/sys/servicepack.sig
    OtaClient_ResourceMetadata: remove old signature file /sys/servicepack.sig
    json_parse_rsrc_metadata_url pBuf is:CDN_url": "http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/",
            "bytes": 31348,
    }
    CDN URL is: http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f40_sys_servicepack.sig

    sl_extLib_OtaRun: entry, state=3
    sl_extLib_OtaRun: ResourceMetadata CDN file URL = http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f40_sys_servicepack.sig
    _ReadFileHeaders: domain=121.42.144.92, file=/OTA/CC3200/Vid01_Pid33_Ver18/f40_sys_servicepack.sig
    _ReadFileHeaders: skip http headers

    sl_extLib_OtaRun: entry, state=4
    CdnClient_Run: Create/Open for write file /sys/servicepack.sig
    CdnClient_Run: file opened

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 256 to file /sys/servicepack.sig total 0.
    CdnClient_Run: End of file and signature length is:0
    CdnClient_Run: Downloading File Completed - Size=256
    sl_extLib_OtaRun: ---- Download file completed /sys/servicepack.sig

    sl_extLib_OtaRun: entry, state=2
    sl_extLib_OtaRun: OtaClient_GetNextUpdate: file=f43_sys_servicepack.ucf, size=31348
    OtaClient_ResourceMetadata: call http_build_request /OTA/CC3200/ver.txt
    OtaClient_ResourceMetadata: file flags=43,metadata flags=43
    OtaClient_ResourceMetadata: file=/sys/servicepack.ucf
    OtaClient_ResourceMetadata: file=/sys/servicepack.ucf is secured with signature
    json_parse_rsrc_metadata_url pBuf is:CDN_url": "http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/",
            "bytes": 31348,
    }
    CDN URL is: http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f43_sys_servicepack.ucf

    sl_extLib_OtaRun: entry, state=3
    sl_extLib_OtaRun: ResourceMetadata CDN file URL = http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f43_sys_servicepack.ucf
    _ReadFileHeaders: domain=121.42.144.92, file=/OTA/CC3200/Vid01_Pid33_Ver18/f43_sys_servicepack.ucf
    _ReadFileHeaders: skip http headers

    sl_extLib_OtaRun: entry, state=4
    CdnClient_Run: Create/Open for write file /sys/servicepack.ucf
    _OpenStorageFile: Signature file name: /sys/servicepack.sig
    CdnClient_Run: file opened

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 0.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 1440.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 2880.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 4320.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 5760.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 7200.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 8640.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 10080.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 11520.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 12960.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 14400.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 15840.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 17280.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 18720.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 20160.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 21600.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 23040.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 24480.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 25920.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 27360.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/servicepack.ucf total 28800.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1108 to file /sys/servicepack.ucf total 30240.
    CdnClient_Run: End of file and signature length is:256
    CdnClient_Run: Download
    ng File Com5l


                     **pleted - Siz***********e=31348
    sl_***********extLib_OtaRu***********n: ---- Down***********load file co***
                        mpleted /sys     CC3200/servicepack OTA Update .ucf

    sl_Application extLib_OtaR
                     *un: entry, ************state=2
    sl************_extLib_Ota************Run: OtaCli************ent_GetNext

     

    App VeUpdate: filrsion          : 0.0e=f80_sys_m.0
    .0.31.1.4.0.g.bin, ion          : 2.8.0size=53608
                OtaClient_1.1.0.3.37

    Wifi Statusadata: call          : Connecthttp_build_red to Janseequest /OTA/n

    NTP SerCC3200/ver.tver          : dmz0xt
    OtaClien.la-archdiot_ResourceMecese.net
    Ntadata: fileTP Server I flags=80,meP           : 209.15tadata flags1.225.100

                                                                                 =80
    GTM Time                nt_ResourceM: Tue Aug 0etadata: fil2 2017 06:5e=/sys/mcuim6:19
    Local g.bin
    Time (+05:30)   : Tue Aug 02 2017 12:26:19

    OTA Update Status       : In Progress...json_parse_rsrc_metadata_url pBuf is:CDN_url": "http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/",
            "bytes": 31348,
    }
    CDN URL is: http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f80_sys_mcuimg.bin

    sl_extLib_OtaRun: entry, state=3
    sl_extLib_OtaRun: ResourceMetadata CDN file URL = http://121.42.144.92/OTA/CC3200/Vid01_Pid33_Ver18/f80_sys_mcuimg.bin
    _ReadFileHeaders: domain=121.42.144.92, file=/OTA/CC3200/Vid01_Pid33_Ver18/f80_sys_mcuimg.bin
    _ReadFileHeaders: skip http headers

    sl_extLib_OtaRun: entry, state=4
    CdnClient_Run: Create/Open for write file /sys/mcuimg.bin
    CdnClient_Run: file opened

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 0.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 1440.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 2880.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 4320.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 5760.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 7200.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 8640.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 10080.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 11520.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 12960.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 14400.

    sl_extLib_OtaRun: entry, state=5
    CdnClient_Run: Write size 1440 to file /sys/mcuimg.bin total 15840.
    CdnClient_Run: Error - SaveFileChunk - (-15)
    sl_extLib_OtaRun ERROR: Failed on CdnClient_Run

    sl_extLib_OtaRun: entry, state=2
    sl_extLib_OtaRun: -------- end of updates
    _OtaCleanToIdle: close OTA client and CDN client and back to IDLE

     


                     *************************************************
                             CC3200 OTA Update Application
                     *************************************************

     

    App Version             : 0.0.0
    Nwp Version             : 2.8.0.0.31.1.4.0.1.1.0.3.37

    Wifi Status             : Power Off

    NTP Server              : dmz0.la-archdiocese.net
    NTP Server IP           : 209.151.225.100

    GTM Time                : Tue Aug 02 2017 06:56:19
    Local Time (+05:30)     : Tue Aug 02 2017 12:26:19

    OTA Update Status       : Completed Rebooting...sl_extLib_OtaInit: OTA lib version = 1.00

     

                     *************************************************
                             CC3200 OTA Update Application
                     *************************************************

     

    App Version             : 0.0.0
    Nwp Version             : 2.9.0.0.31.1.4.0.1.1.0.3.37

    Wifi Status             : Connected to Jansen

    NTP Server              : dmz0.la-archdiocese.net
    NTP Server IP           : 209.151.225.100

    GTM Time                : Tue Aug 02 2017 06:56:32
    Local Time (+05:30)     : Tue Aug 02 2017 12:26:32

    OTA Update Status       : Press SW3 : Updates or SW2: Factory Reset

  • 如果有/sys/mcuimg2.bin, /sys/mcuimg3.bin。 那么在OTA时, 待升级sys_mcuimg.bin更新到哪个文件了?
    是根据mcubootinfo.bin判断吗?