找回密码
 立即注册

微信扫码登录

查看: 103|回复: 1

OTA Firemware update - error ZCL_STA_INVALID_IMAGE

[复制链接]

11

主题

26

回帖

201

积分

中级会员

积分
201
发表于 2024-11-27 09:54:13 | 显示全部楼层 |阅读模式
本帖最后由 wes58 于 2024-11-30 05:59 编辑

I have decided to start a new thread with this issue.
When I have been testing OTA I was using Zigbee SDK v3.6.8.1. And everything worked fine.
I have deicded to change to SDK v3.7.1 and now OTA fails with the error ZCL_STA_INVALID_IMAGE. But we don't have any feedback about the upgrade!

And, that's why what I mentioned in the previous thread abotu OTA, there should be some messages about the progress/status of device upgrade.

The device has the firmware compiled with SDK v3.7.1
The firmware with the higher file version is compiled with the same SDK and transfered into the Gateway.
But as I mentioned before, zigbee_ota_tool_v2.2.exe doesn't update the header with the correct type or file version, so I had to update the header myself.
See the pictures showing it.

When the firwmare is uploaded from the gateway to the device upgrade fails with error ZCL_STA_INVALID_IMAGE.
I have found out that it fails in ota.c function - ota_imageDataProcess(u8 len, u8 *pData)
if(otaClientInfo.otaElementPos == otaClientInfo.otaElementLen){
    u16 crcFirmware = 0;
    flash_read(baseAddr + 6, 2, (u8 *)&crcFirmware);
    if(((crcFirmware & 0xff) == 0x5D) && ((crcFirmware >> 8) & 0xff) == 0x02){
        u32 crcReceived;
        flash_read(baseAddr + dataEndPos - 4, 4, (u8 *)&crcReceived);

        if(crcReceived != otaClientInfo.crcValue){
            return ZCL_STA_INVALID_IMAGE;
        }
        validChecked = 1;
    }else{
    ****FAILS HERE!!!!****
        return ZCL_STA_INVALID_IMAGE;
    }
}

value of vairable crcFirmware is 0x0000

I decided to use the device with the same firmware and upgrade it with the firmware compiled with SDK v3.6.8.1. The result was: crcFirmware = 0x025D
I have also noticed that there is no CRC at the end of image file.
After spending a lot of time I have found the reson.
The file tl_check_fw2.exe has been deleted by virus scan.

image.png

In regards to the issue with the FILE_VERSION and IMAGE_TYPE I have found the following:
This is what I found in file cstartup_8258.S
.extern FILE_VERSION
    .extern MANUFACTURER_CODE_TELINK
    .extern IMAGE_TYPE
    .org 0x0
    tj    __reset
    .word    (FILE_VERSION)
    .org 0x8
    .word    (0x544c4e4b)
#if MOVE_BIN_CODE_EN
    .word    (0x00880000 + _bin_size_div_16)
#else
    .word    (0x00880000 + _ramcode_size_div_16_align_256_)
#endif
    .org 0x10
    tj        __irq
    .org 0x12
    .short  (MANUFACTURER_CODE_TELINK)
    .short  (IMAGE_TYPE)

in this startup assembly file FILE_VERSION and IMAGE_TYPE are not updated to the values defined in version_cfg.h. After renaming FILE_VERSION and IMAGE_TYPE to a different name in version_cfg.h the project still compiles. This means that cstartup_8258.S doesn't use those defines. So it can't work.




ota_fileend.png
header.png

11

主题

26

回帖

201

积分

中级会员

积分
201
 楼主| 发表于 7 天前 | 显示全部楼层
本帖最后由 wes58 于 2024-12-2 04:07 编辑

And I have tried another thing to check the issue with FILE_VERSION and IMAGE_TYPE.
When you create a new project configuration you use an option "Copy Settings from existing configuration" - see picture below.
My project was based on "Sample_Light" project configuration.
I deleted the "Sample_Light" folder from the app folder and the result was as on the picture below - error that version_cfg.h is missing. So startup_8258.S is using FILE_VERSION and IMAGE_TYPE from version_cfg.h in the Sample_Light project and not in my new project.

image.png

After searching in the project properties I found out where I have to make another change to replace SampleLight with my project/app name.

image.png

I wish that Telink described the process of creating new Configuration/Project in SDK manual. When you "Copy Settings" from configuration I would expect that everything is copied correctly and I don't have to make any changes. It doesn't tell you what other changes you have to make in project properties. This is the second change you have to make in the project properties.
I have wasted so much time on this, and other issuses related to trying OTA




您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2024-12-8 04:20 , Processed in 0.088307 second(s), 21 queries .

Powered by Telink 隐私政策

泰凌微电子版权所有 © 。保留所有权利。 2024

快速回复 返回顶部 返回列表