This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

OTA_Solution

Overview

This application is a reference solution for device over-the-air (OTA) firmware upgrade functionality using WM IoT SDK. It demonstrates how a device connects to the network via Wi-Fi and communicates with the server using the MQTT protocol to perform OTA firmware upgrades. It includes features such as Wi-Fi initialization, network time synchronization, firmware version reporting, OTA command reception and parsing, firmware downloading, signature verification, real-time reporting of upgrade status, and error handling. Additionally, it provides periodic update checks and rich logging to ensure transparency and reliability throughout the entire OTA upgrade process.

OTA Architecture

OTA Architecture

OTA_Solution sequence diagram

1. Push upgrade sequence diagram

OTA Push Upgrade

2. Regularly check the upgrade sequence diagram

OTA Regular Checks for Upgrades

OTA MQTTS Payload

1. Device Firmware Version Report (Device sends message): topic: wm_iot/${mac_addr}/ota/firmware/report

topic: wm_iot/${mac_addr}/ota/firmware/report // mac_addr: Station MAC address.
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": { // Device firmware version information.
        "type": "INIT", // Business type. INIT: Firmware version initialization; UPDATE: Firmware upgrade completed version update.
        "version": "1.1.6", // Version number is represented in MAJOR.MINOR.PATCH dot notation, supporting a range from 0.0.0 to 99.99.99. For example: 1.0.0.
        "build_time": "May 24 2024 10:33:41" // Firmware compilation time
    }
}

2. Cloud OTA Upgrade (Device receives message): topic: wm_iot/${mac_addr}/ota/update

topic: wm_iot/${mac_addr}/ota/update // mac_addr: Station MAC address.
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": { // OTA upgrade information.
        "version": "1.3.13", // Version number is represented in MAJOR.MINOR.PATCH dot notation, supporting a range from 0.0.0 to 99.99.99. For example: 1.0.0.
        "http_url": "http://xxx.com/firmware/bin/xxx_ota.img",  // Firmware URL address.
        "https_url": "https://xxx.com/firmware/bin/xxx_ota.img",  // HTTPS firmware URL proxy address.
        "size": 1306707, // In bytes.
        "sig-sha256-ecdsa": "MEQCIGDnxeN5XkZPhf+lgf/OGFrJ/8hZ4nShkqpG7bpGS7y/AiAVEp9+hR9RYJH3TWQfl9a/iwMa5engJ8alCpkJNkZaDg==", // First calculate the SHA256 digest of the firmware, then perform ECDSA signature
        "upgrade_delay": 0 // Used to specify the upgrade time for the device for automatic upgrade, 0 or less than the current time means execute immediately.
    }
}

3. Device Firmware Upgrade Request (Device sends message): topic: wm_iot/${mac_addr}/ota/get

topic: wm_iot/${mac_addr}/ota/get // mac_addr: Station MAC address.
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": {} // Get OTA parameters.
}

4. Device Firmware Upgrade Response (Device receives message): topic: wm_iot/${mac_addr}/ota/response

topic: wm_iot/${mac_addr}/ota/response // mac_addr: Station MAC address.
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": { // OTA upgrade information.
        "version": "1.3.13", // Version number is represented in MAJOR.MINOR.PATCH dot notation, supporting a range from 0.0.0 to 99.99.99. For example: 1.0.0.
        "http_url": "http://xxx.com/firmware/bin/xxx_ota.img",  // Firmware URL address.
        "https_url": "https://xxx.com/firmware/bin/xxx_ota.img",  // HTTPS firmware URL proxy address.
        "size": 1306707, // In bytes.
        "sig-sha256-ecdsa": "MEQCIGDnxeN5XkZPhf+lgf/OGFrJ/8hZ4nShkqpG7bpGS7y/AiAVEp9+hR9RYJH3TWQfl9a/iwMa5engJ8alCpkJNkZaDg==", // First calculate the SHA256 digest of the firmware, then perform ECDSA signature
        "upgrade_delay": 0 // Used to specify the upgrade time for the device for automatic upgrade, 0 or less than the current time means execute immediately.
    }
}

5.Report Upgrade Progress or Status (Device receives message): topic: wm_iot/${mac_addr}/ota/progress/report

topic: wm_iot/${mac_addr}/ota/progress/report // mac_addr: Station MAC address. Report upgrade progress:
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": {
        "progress": 98 // Only needed to report the upgrade progress during the upgrade, so the progress field as long as it is greater than or equal to 0, it indicates the upgrading state. Range: 0-100.
    }
}
Report upgrade exception status:
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": {
        "errorCode": -100001, // If there is an exception during the upgrade, the errorCode field must be passed. Firmware upgrade exception codes are as follows: see WM_ERR_OTA_XXX
        "errorMsg":"Download failed, FLASH space is insufficient" // If an exception occurs, this field can carry error information, not exceeding 20 characters in length.
    }
}

6.Report Device Firmware Version After Successful Upgrade (Device sends message): topic: wm_iot/${mac_addr}/ota/firmware/report

topic: wm_iot/${mac_addr}/ota/firmware/report // mac_addr: Station MAC address.
{
    "msg_sequence": 0, // 0-2^32, the request and response messages are correlated by this value.
    "time": 1626197189638, // Unix timestamp when the message is sent, 10-digit second-level or 13-digit millisecond-level.
    "data": { // Device firmware version information.
        "type": "UPDATE", // Business type. INIT: Firmware version initialization; UPDATE: Firmware upgrade completed version update.
        "version": "1.1.6", // Version number is represented in MAJOR.MINOR.PATCH dot notation, supporting a range from 0.0.0 to 99.99.99. For example: 1.0.0.
        "build_time": "May 24 2024 10:33:41" // Firmware compilation time
    }
}

Requirements

  1. Please set up your own OTA server and contact the manufacturer to provide relevant Python scripts for testing.

  2. Configure EXPLLE_WIFI_SSID, EXPLLE_WIFI_PASSWORD, and MQTTS_BROKER_URI using wm.py menuconfig or wm.py guiconfig.

Building and flashing

Example Location: examples\ota\ota_solution

compile, burn, and more, see: get started

Running result

Successfully running will output the following logs

D/main            [0.000] boot reason 0
D/main            [0.004] heap size 266776(260.52KB)
D/fls             [0.010] flash size 0x200000(2MB)
D/ptb             [0.014] partition table base 0x800e000
D/ft              [0.018] ft_0 base 8000000, ft_1 base 8001000
D/ft              [0.024] ft init 1
E/nvs             [0.028] use new hash entry num=53
I/ota_http        [0.034] 0.3.0 build at Jun 13 2024 14:37:14

D/wifi            [2.100] distribution event 1
D/wifi            [2.106] sta connected E0-F4-42-A1-95-E8 channel 11 authmode 3
D/wifi            [9.040] distribution event 0
D/wifi            [9.044] sta got ip 10.17.1.111
I/example         [19.098] Now datetime: 2024-6-13 15:6:40

D/mqtt            [19.102] uri: ssl://10.17.1.110:8883
D/mqtt            [19.108] mqtt_config mode: 3
D/mqtt            [19.114] mode: MQTT_AUTH_MODE_MUTUAL_AUTH
D/mqtt            [19.118] ======================================
D/mqtt            [19.124] Trace Output
D/mqtt            [19.128] se Paho Synchronous MQTT C Client Library
D/mqtt            [19.134] se Paho Synchronous MQTT C Client Library
D/mqtt            [19.140] 10
D/mqtt            [19.144] ======================================
D/mqtt            [19.250] connect out: rc=119
D/mqtt            [19.254] wait connect, timeout: 29896
D/mqtt            [19.454] wait end
E/mqtt            [19.456]  client W800_32AF70, packet_type 1, timeout 29896, pack 0x0

> Seeding the random number generator...
  ok
> Loading the CA root certificate ...
  ok
> Loading the client cert. and key...
  ok (key type: RSA)
> Setting up the SSL/TLS structure...
  ok
> Performing the SSL/TLS handshake...
  ok
SSLSocket_putdatas: mbedtls_ssl_write rc 27, iov_len 27
D/mqtt            [20.848] wait connect ack, timeout: 28308
D/mqtt            [20.854] wait end
E/mqtt            [20.858]  client W800_32AF70, packet_type 2, timeout 28308, pack 0x0
D/mqtt            [20.866] MQTTClient connected!
I/example         [20.870] MQTTS connected
D/mqtt            [20.874] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/firmware/report
SSLSocket_putdatas: mbedtls_ssl_write rc 178, iov_len 178
D/mqtt            [20.890] mqtt client publish, token: 1
I/example         [20.896] Publish ota firmware report, msg_id=1, payload:
{
	"msg_sequence":	0,
	"time":	20872,
	"data":	{
		"type":	"INIT",
		"version":	"0.3.0",
		"build_time":	"Jun 13 2024 15:02:41"
	}
}
D/mqtt            [20.914] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/update, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 37, iov_len 37
D/mqtt            [20.932] wait sub ack, timeout: 10000
D/mqtt            [20.940] Message with token value 1 delivery confirmed
D/mqtt            [20.948] wait end
E/mqtt            [20.950]  client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example         [20.958] Subscribe ota update, msg_id=2
D/mqtt            [20.964] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/response, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 39, iov_len 39
D/mqtt            [20.980] wait sub ack, timeout: 10000
D/mqtt            [20.986] wait end
E/mqtt            [20.990]  client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example         [20.996] Subscribe ota response, msg_id=3
I/example         [21.002] MQTTS published, msg_id=1
D/mqtt            [81.004] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/get
SSLSocket_putdatas: mbedtls_ssl_write rc 86, iov_len 86
D/mqtt            [81.018] mqtt client publish, token: 4
I/example         [81.022] Publish ota get, msg_id=4, payload:
{
	"msg_sequence":	3,
	"time":	81002,
	"data":	{
	}
}
D/mqtt            [81.036] Message with token value 4 delivery confirmed
I/example         [81.042] MQTTS published, msg_id=4
SSLSocket_putdatas: mbedtls_ssl_write rc 4, iov_len 4
D/mqtt            [105.542] Message arrived, topic [/wm_iot/286DCE32AF7/ota/update], payload [{"msg_sequence": 0, "time": 1718262549281, "data": {"version": "0.3.1", "http_url": "http://10.17.1.110:8090/firmware/ota_solution_ota.img", "https_url": "https://10.17.1.110:8083/firmware/ota_solution_ota.img", "size": 342012, "sig-sha256-ecdsa": "MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=", "upgrade_delay": 1000}}]
I/example         [105.584] MQTT recved data:
I/example         [105.588] Topic(0):/wm_iot/286DCE32AF7/ota/update
I/example         [105.594] Payload(371):
{"msg_sequence": 0, "time": 1718262549281, "data": {"version": "0.3.1", "http_url": "http://10.17.1.110:8090/firmware/ota_solution_ota.img", "https_url": "https://10.17.1.110:8083/firmware/ota_solution_ota.img", "size": 342012, "sig-sha256-ecdsa": "MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=", "upgrade_delay": 1000}}
I/example         [105.634] Version: 0.3.1
I/example         [105.636] HTTP URL: http://10.17.1.110:8090/firmware/ota_solution_ota.img
I/example         [105.644] HTTPS URL: https://10.17.1.110:8083/firmware/ota_solution_ota.img
I/example         [105.654] Size: 342012
I/example         [105.656] Signature: MEUCIQCk+nEoZFZTjYs7teOIDX0HKUv4/8kRJtailqBlqHfDTQIgdr+8SCrvUu6Gvg8rHcv+ewH3JNIenGOc7zYz9KuUPvE=
I/example         [105.668] Upgrade Delay: 1000
D/ota_ops         [105.674] ota partition offset=0x0000f000,size=0x122a00
D/ota_ops         [105.680] app_ota partition offset=0x00131a00,size=0xae600
D/example         [106.040] OTA progress:0-0%.
D/example         [106.044] OTA progress:1-0%.
I/NO_TAG          [106.048] pHTTPSession->HttpConnection.HttpSocket=2


  . Seeding the random number generator... ok
  . Loading the CA root certificate ... ok (0 skipped)
  . Connecting to tcp... ok
  . Setting up the SSL/TLS structure... ok
  . Performing the SSL/TLS handshake... ok
D/ota_http        [106.664] WM_HTTP_EVENT_CONNECTED
D/ota_http        [106.674] WM_HTTP_EVENT_HEADER_SENTED
D/ota_http        [106.758] WM_HTTP_EVENT_RECV_HEADER
D/example         [106.764] OTA progress:3-0%.
D/example         [106.768] OTA progress:4-0%.
D/mqtt            [106.772] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 115, iov_len 115
D/mqtt            [106.790] mqtt clientD/mqtt           publish, token: 5
I/  [106.796] Message witexample         [106.79h token value 5 deliver8] Publish ota progressy confirmed
I/example         [106.806] MQTTS published, msg_id=5
 report, msg_id=5, payload:
{
	"msg_sequence":	4,
	"time":	106770,
	"data":	{
		"progress":	0
	}
}
D/ota_ops         [106.916] magic_no: A0FFFF9F
D/ota_ops         [106.920] img_attr: 00100001
D/ota_ops         [106.924] img_addr: 0800F400
D/ota_ops         [106.928] img_len: 000537BC
D/ota_ops         [106.932] img_header_addr: 0800F000
D/ota_ops         [106.938] upgrade_img_addr: 08131A00
D/ota_ops         [106.942] org_checksum: 8607BCD4
D/ota_ops         [106.946] upd_no: 00000000
D/ota_ops         [106.950] ver: 0.3.0
D/ota_ops         [106.954] _reserved0: 00000000
D/ota_ops         [106.958] _reserved1: 00000000
D/ota_ops         [106.962] next: 00000000
D/ota_ops         [106.966] hd_checksum: C9F2066F
W/ota_ops         [106.972] ota version error
.D/example         [106.994] OTA progress:4-1%.
.D/example         [107.020] OTA progress:4-2%.
.D/example         [107.046] OTA progress:4-3%.
.D/example         [107.072] OTA progress:4-4%.
.D/example         [107.184] OTA progress:4-5%.
.D/example         [107.208] OTA progress:4-7%.
.D/example         [107.236] OTA progress:4-8%.
.D/example         [107.262] OTA progress:4-9%.
.D/example         [107.376] OTA progress:4-10%.
D/mqtt            [107.380] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt            [107.398] mqttD/mqtt           client publish, token  [107.404] Message wit: 6
I/example         h token value 6 deliver[107.410] Publish ota py confirmed
I/example         [107.414] MQTTS published, msg_id=6
rogress report, msg_id=6, payload:
{
	"msg_sequence":	5,
	"time":	107378,
	"data":	{
		"progress":	10
	}
}
.D/example         [107.450] OTA progress:4-11%.
.D/example         [107.476] OTA progress:4-13%.
.D/example         [107.502] OTA progress:4-14%.
.D/example         [107.616] OTA progress:4-15%.
.D/example         [107.642] OTA progress:4-16%.
.D/example         [107.668] OTA progress:4-17%.
.D/example         [107.692] OTA progress:4-19%.
.D/example         [107.806] OTA progress:4-20%.
D/mqtt            [107.810] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt            [107.826] mqtt client publish, token: 7
I/example         [D/mqtt           107.832] Publish ota pr [107.838] Message withogress report, msg_id=7 token value 7 delivery, payload:
{
	"msg_s confirmed
I/example         [107.848] MQTTS published, msg_id=7
equence":	6,
	"time":	107808,
	"data":	{
		"progress":	20
	}
}
.D/example         [107.880] OTA progress:4-21%.
.D/example         [107.906] OTA progress:4-22%.
.D/example         [107.930] OTA progress:4-23%.
.D/example         [108.046] OTA progress:4-25%.
.D/example         [108.070] OTA progress:4-26%.
.D/example         [108.096] OTA progress:4-27%.
.D/example         [108.122] OTA progress:4-28%.
.D/example         [108.264] OTA progress:4-29%.
.D/example         [108.288] OTA progress:4-31%.
.D/example         [108.314] OTA progress:4-32%.
.D/example         [108.340] OTA progress:4-33%.
.D/example         [108.456] OTA progress:4-34%.
.D/example         [108.482] OTA progress:4-35%.
.D/example         [108.506] OTA progress:4-37%.
.D/example         [108.532] OTA progress:4-38%.
.D/example         [108.654] OTA progress:4-39%.
.D/example         [108.680] OTA progress:4-40%.
D/mqtt            [108.686] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt            [108.702] mqtt client publishD/mqtt          , token: 8
I/example    [108.710] Message wi       [108.712] Publisth token value 8 deliveh ota progress report, ry confirmed
I/example         [108.720] MQTTS published, msg_id=8
msg_id=8, payload:
{
	"msg_sequence":	7,
	"time":	108684,
	"data":	{
		"progress":	40
	}
}
.D/example         [108.756] OTA progress:4-41%.
.D/example         [108.782] OTA progress:4-43%.
.D/example         [108.898] OTA progress:4-44%.
.D/example         [108.924] OTA progress:4-45%.
.D/example         [108.950] OTA progress:4-46%.
.D/example         [108.976] OTA progress:4-47%.
.D/example         [109.090] OTA progress:4-49%.
.D/example         [109.116] OTA progress:4-50%.
D/mqtt            [109.120] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt            [109.138] mqtt D/mqtt          client publish, token:   [109.144] Message wit9
I/example         [1h token value 9 deliver09.146] Publish ota proy confirmed
I/example         [109.154] MQTTS published, msg_id=9
gress report, msg_id=9, payload:
{
	"msg_sequence":	8,
	"time":	109118,
	"data":	{
		"progress":	50
	}
}
.D/example         [109.190] OTA progress:4-51%.
.D/example         [109.216] OTA progress:4-52%.
.D/example         [109.332] OTA progress:4-53%.
.D/example         [109.356] OTA progress:4-55%.
.D/example         [109.384] OTA progress:4-56%.
.D/example         [109.408] OTA progress:4-57%.
.D/example         [109.524] OTA progress:4-58%.
.D/example         [109.550] OTA progress:4-59%.
.D/example         [109.576] OTA progress:4-61%.
.D/example         [109.602] OTA progress:4-62%.
.D/example         [109.714] OTA progress:4-63%.
.D/example         [109.740] OTA progress:4-64%.
.D/example         [109.766] OTA progress:4-65%.
.D/example         [109.792] OTA progress:4-67%.
.D/example         [109.904] OTA progress:4-68%.
.D/example         [109.928] OTA progress:4-69%.
.D/example         [109.954] OTA progress:4-70%.
D/mqtt            [109.960] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 116, iov_len 116
D/mqtt            [109.976D/mqtt          ] mqtt client publish,   [109.982] tokenMessage with token valu: 10
I/example        e 10 delivery confirmed [109.990] Publish ota
I/example         [109.992] MQTTS published, msg_id=10
progress report, msg_id=10, payload:
{
	"msg_sequence":	9,
	"time":	109956,
	"data":	{
		"progress":	70
	}
}
.D/example         [110.030] OTA progress:4-71%.
.D/example         [110.142] OTA progress:4-73%.
.D/example         [110.168] OTA progress:4-74%.
.D/example         [110.194] OTA progress:4-75%.
.D/example         [110.220] OTA progress:4-76%.
.D/example         [110.340] OTA progress:4-77%.
.D/example         [110.366] OTA progress:4-79%.
.D/example         [110.390] OTA progress:4-80%.
D/mqtt            [110.396] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 117, iov_len 117
D/mqtt            [110.412] mqtt client publish, token: 11D/mqtt
I/example         [11  [110.422] Message wi0.422] Publish ota progth token value 11 delivress report, msg_id=11,ery confirmed
I/example         [110.432] MQTTS published, msg_id=11
 payload:
{
	"msg_sequence":	10,
	"time":	110394,
	"data":	{
		"progress":	80
	}
}
.D/example         [110.466] OTA progress:4-81%.
.D/example         [110.588] OTA progress:4-82%.
.D/example         [110.614] OTA progress:4-83%.
.D/example         [110.640] OTA progress:4-85%.
.D/example         [110.664] OTA progress:4-86%.
.D/example         [110.776] OTA progress:4-87%.
.D/example         [110.802] OTA progress:4-88%.
.D/example         [110.828] OTA progress:4-89%.
.D/example         [110.854] OTA progress:4-91%.
.D/example         [110.966] OTA progress:4-92%.
.D/example         [110.992] OTA progress:4-93%.
.D/example         [111.018] OTA progress:4-94%.
.D/example         [111.044] OTA progress:4-95%.
.D/example         [111.146] OTA progress:4-97%.
.D/example         [111.172] OTA progress:4-98%.
.D/example         [111.198] OTA progress:4-99%.
.D/example         [111.212] OTA progress:4-100%.
D/mqtt            [111.218] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/progress/report
SSLSocket_putdatas: mbedtls_ssl_write rc 118, iov_len 118
D/mqtt            [111.234] mqtt client publiD/mqtt          sh, token: 12
I/exampl  [111.242] Message wite         [111.244] Pubh token value 12 delivelish ota progrery confirmed
I/example         [111.252] MQTTS published, msg_id=12
ss report, msg_id=12, payload:
{
	"msg_sequence":	11,
	"time":	111216,
	"data":	{
		"progress":	100
	}
}
.
D/example         [111.268] OTA progress:6-100%.
I/example         [111.470] SHA-256 ECDSA signature verification successful.
I/ota_ops         [111.600] ota reboot, please wait for the restart...
D/main            [0.000] boot reason 4
D/main            [0.004] heap size 266776(260.52KB)
D/fls             [0.010] flash size 0x200000(2MB)
D/ptb             [0.014] partition table base 0x800e000
D/ft              [0.018] ft_0 base 8000000, ft_1 base 8001000
D/ft              [0.024] ft init 1
E/nvs             [0.028] use new hash entry num=53
I/ota_http        [0.034] 0.3.0 build at Jun 13 2024 14:37:14

D/wifi            [1.978] distribution event 1
D/wifi            [1.982] sta connected E0-F4-42-A1-95-E8 channel 11 authmode 3
D/wifi            [3.040] distribution event 0
D/wifi            [3.044] sta got ip 10.17.1.111
I/example         [13.098] Now datetime: 2024-6-13 15:8:48

D/mqtt            [13.104] uri: ssl://10.17.1.110:8883
D/mqtt            [13.110] mqtt_config mode: 3
D/mqtt            [13.114] mode: MQTT_AUTH_MODE_MUTUAL_AUTH
D/mqtt            [13.120] ======================================
D/mqtt            [13.126] Trace Output
D/mqtt            [13.130] se Paho Synchronous MQTT C Client Library
D/mqtt            [13.136] se Paho Synchronous MQTT C Client Library
D/mqtt            [13.142] 10
D/mqtt            [13.144] ======================================
D/mqtt            [13.252] connect out: rc=119
D/mqtt            [13.258] wait connect, timeout: 29894
D/mqtt            [13.458] wait end
E/mqtt            [13.460]  client W800_32AF70, packet_type 1, timeout 29894, pack 0x0

> Seeding the random number generator...
  ok
> Loading the CA root certificate ...
  ok
> Loading the client cert. and key...
  ok (key type: RSA)
> Setting up the SSL/TLS structure...
  ok
> Performing the SSL/TLS handshake...
  ok
SSLSocket_putdatas: mbedtls_ssl_write rc 27, iov_len 27
D/mqtt            [14.816] wait connect ack, timeout: 28342
D/mqtt            [14.820] wait end
E/mqtt            [14.824]  client W800_32AF70, packet_type 2, timeout 28342, pack 0x0
D/mqtt            [14.832] MQTTClient connected!
I/example         [14.836] MQTTS connected
D/mqtt            [14.840] mqtt client publish, topic /wm_iot/286DCE32AF7/ota/firmware/report
SSLSocket_putdatas: mbedtls_ssl_write rc 180, iov_len 180
D/mqtt            [14.858] mqtt client publish, token: 1
I/example         [14.862] Publish ota firmware report, msg_id=1, payload:
{
	"msg_sequence":	0,
	"time":	14838,
	"data":	{
		"type":	"UPDATE",
		"version":	"0.3.0",
		"build_time":	"Jun 13 2024 15:02:41"
	}
}
D/mqtt            [15.000] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/update, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 37, iov_len 37
D/mqtt            [15.016] wait sub ack, timeout: 10000
D/mqtt            [15.022] Message with token value 1 delivery confirmed
D/mqtt            [15.030] wait end
E/mqtt            [15.034]  client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example         [15.042] Subscribe ota update, msg_id=2
D/mqtt            [15.048] mqtt client subscribe, topic /wm_iot/286DCE32AF7/ota/response, qos 1
SSLSocket_putdatas: mbedtls_ssl_write rc 39, iov_len 39
D/mqtt            [15.064] wait sub ack, timeout: 10000
D/mqtt            [15.070] wait end
E/mqtt            [15.072]  client W800_32AF70, packet_type 9, timeout 10000, pack 0x0
I/example         [15.082] Subscribe ota response, msg_id=3
I/example         [15.086] MQTTS published, msg_id=1