espressif / esp-ali-smartliving

阿里云生活物联网平台 & 天猫精灵 IoT 开放平台
79 stars 34 forks source link

ESP8266 使用阿里云OTA升级失败 #23

Open githubsztows opened 3 years ago

githubsztows commented 3 years ago

1. 开发环境

2. 问题描述

使用ESP8266_RTOS_SDK\esp-ali-smartliving\examples\ota\ota_example_mqtt下的demo测试阿里云的ota升级,老是失败。 见下面日志。看日志阿里云下发的升级的json相关信息,包括要升级的版本号,sign,升级的URL等信息,但是json中没有digestSign这个key,导致阿里云的sdk中解析出错(日志显示:Not digestSign key in json doc of OTA)

2.1 复现步骤

2.2 复现问题的代码

3. 调试 Logs

_ota_mqtt_client|181 :: wait ota upgrade command.... _ota_mqtt_client|181 :: wait ota upgrade command.... _ota_mqtt_client|181 :: wait ota upgrade command.... dbg iotx_mc_cycle(1880): PUBLISH dbg iotx_mc_handle_recv_PUBLISH(1639): Packet Ident : 00000000 dbg iotx_mc_handle_recv_PUBLISH(1640): Topic Length : 43 dbg iotx_mc_handle_recv_PUBLISH(1644): Topic Name : /ota/device/upgrade/a1kStGsS7L7/AOTA0000001 dbg iotx_mc_handle_recv_PUBLISH(1647): Payload Len/Room : 418 / 2000 dbg iotx_mc_handle_recv_PUBLISH(1648): Receive Buflen : 2048 dbg iotx_mc_handle_recv_PUBLISH(1661): delivering msg ... dbg iotx_mc_deliver_message(1361): topic be matched dbg otamqtt_UpgrageCb(107): topic=/ota/device/upgrade/a1kStGsS7L7/AOTA0000001 dbg otamqtt_UpgrageCb(108): len=418, topic_msg={"code":"1000","data":{"size":713232,"sign":"955b618c645f802f48ad77bf74441c0e","ver sion":"0.0.4","url":"https://iotx-ota.oss-cn-shanghai.aliyuncs.com/ota/f3fe6457dfae7a6ddf8e4cb1eadf3a1d/ckra0fiej00003b6ql5qud9dy.bin?Expire s=1626748424& ... dbg otamqtt_UpgrageCb(123): receive device upgrade err otalib_GetFirmwareVarlenPara(132): Not digestSign key in json doc of OTA err otalib_GetFotaParams(272): get value of digestSign key failed, maybe not security ota inf httpclient_common(866): host: 'iotx-ota.oss-cn-shanghai.aliyuncs.com', port: 443 E (830365) esp-tls-wolfssl: wolfSSL_connect returned -0x1 E (830366) esp-tls-wolfssl: Failed to verify peer certificate , returned 28! E (830377) esp-tls: Failed to open new connection err httpclient_conn(71): httpclient_conn fail err httpclient_common(878): httpclient_connect is error, ret = -8 inf httpclient_close(855): client disconnected err ofc_Fetch(110): fetch firmware failed err IOT_OTA_FetchYield(841): Fetch firmware failed E (830441) esp_ota_ops: OTA image has invalid magic byte (expected 0xE9, saw 0xa5 E (830454) ota: esp_ota_write failed, err=0x1503 _ota_mqtt_client|196 :: write data to file failed dbg IOT_OTA_Ioctl(1072): origin=, now=d41d8cd98f00b204e9800998ecf8427e _ota_mqtt_client|222 :: The firmware is invalid E (832485) ota: esp_ota_write failed! err=0x1503 dbg iotx_mc_disconnect(2862): rc = MQTTDisconnect() = 0 inf iotx_mc_disconnect(2871): mqtt disconnect! inf iotx_mc_release(2964): mqtt release! inf LITE_dump_malloc_free_stats(693): WITH_MEM_STATS = 0 ota_main|267 :: out of sample! Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled. Core 0 register dump: PC : 0x00000000 PS : 0x00000030 A0 : 0x00000000 A1 : 0x3fff9400 A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000005 A5 : 0x00000000 A6 : 0x40230354 A7 : 0x000001f4 A8 : 0x00000000 A9 : 0x00000310 0x40230354: __swrite at /home/dongheng/workspace/espressif/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-lx106-elf/newlib/libc/stdio/.. /../../.././newlib/libc/stdio/stdio.c:81

4. 其他项

ESP-YJM commented 3 years ago

建议使用 smart_light 和 smart_solo 示例。