本帖最后由 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.
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.
|