Merge branch 'feat/simple_ota_h2_v5.4' into 'release/v5.4'

feat(openthread/ota): support esp32h2 for simple ota example over thread (v5.4)

See merge request espressif/esp-idf!43991
This commit is contained in:
Shu Chen
2025-12-08 15:38:02 +00:00
12 changed files with 79 additions and 23 deletions
+4 -15
View File
@@ -132,10 +132,6 @@ examples/system/nmi_isr:
reason: test NMI for Xtensa targets only
examples/system/ota/advanced_https_ota:
disable:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: target esp32h2 is not supported yet
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
temporary: true
@@ -150,12 +146,9 @@ examples/system/ota/advanced_https_ota:
- esp_phy
- bt
- protocol_examples_common
- openthread
examples/system/ota/native_ota_example:
disable:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: target esp32h2 is not supported yet
disable_test:
- if: IDF_TARGET != "esp32"
reason: Only esp32 has ethernet runners
@@ -167,16 +160,13 @@ examples/system/ota/native_ota_example:
- esp_driver_gpio
- bootloader_support
- protocol_examples_common
- openthread
examples/system/ota/otatool:
enable:
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET in ["esp32c5", "esp32c61"]
examples/system/ota/pre_encrypted_ota:
disable:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: target esp32h2 is not supported yet
disable_test:
- if: IDF_TARGET != "esp32"
temporary: true
@@ -189,12 +179,10 @@ examples/system/ota/pre_encrypted_ota:
- mbedtls
- bootloader_support
- protocol_examples_common
- openthread
examples/system/ota/simple_ota_example:
disable:
- if: IDF_TARGET in ["esp32h2"]
temporary: true
reason: target esp32h2 is not supported yet
- if: CONFIG_NAME == "spiram" and SOC_SPIRAM_SUPPORTED != 1
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
@@ -209,6 +197,7 @@ examples/system/ota/simple_ota_example:
- esp_wifi
- esp_phy
- mbedtls
- openthread
examples/system/perfmon:
enable:
+40
View File
@@ -150,6 +150,46 @@ The ``native_ota_example`` contains code to demonstrate how to check the version
In ``native_ota_example``, ``$PROJECT_PATH/version.txt`` is used to define the app version. Change the version in the file to compile the new firmware.
## OTA over Thread
These examples also support OTA (Over-the-Air) updates over a Thread network and supports binding to a Thread interface on targets with native IEEE 802.15.4 support, such as the ESP32-H2.
### Thread Connectivity Prerequisites
To enable OTA over Thread, you need a Thread End Device (which is the "ESP-Dev-Board", for example, ESP32-H2) and a [Thread Border Router](https://github.com/espressif/esp-thread-br). IPv6 connectivity must be established between the Thread End Device, the Thread Border Router, and the HTTP server. You can follow the guide in [Bi-directional IPv6 Connectivity](https://docs.espressif.com/projects/esp-thread-br/en/latest/codelab/connectivity.html) for setup instructions.
Once IPv6 connectivity is established, the HTTP server will receive a valid IPv6 address starting with the On-link Prefix assigned by the Thread Border Router. This address will be used by the Thread End Device to retrieve the OTA binary.
### HTTP(S) Server Requirements
When running the HTTP(S) server, ensure that it supports IPv6. This can be achieved using a OpenSSL based server as detailed above:
```
openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070
```
* **Note:** Use the IPv6 address from the Bi-directional IPv6 Connectivity guide to generate the certificate (CN prompt).
* **Note:** The example script for the Python based server does not support IPv6 by default.
An alternative means of debugging with IPv6 support is to use Python's built-in HTTP server with the `--bind ::` option:
```
python -m http.server 8070 --bind ::
```
OTA over Thread only supports IPv6 addresses. If the HTTP(S) server can only be accessed via an IPv4 address, the End Device will need to synthesize an IPv6 address using the [NAT64](https://docs.espressif.com/projects/esp-thread-br/en/latest/codelab/nat64.html) feature.
### Thread Configuration Options (End Device)
- `idf.py menuconfig → Component config → OpenThread → OpenThread` = `y` *(enabled by default for ESP32-H2)*
- `idf.py menuconfig → Component config → OpenThread → Thread Core Features → Thread Operational Dataset` — must match the Border Router configuration
- `idf.py menuconfig → Component config → Example Configuration → firmware upgrade URL endpoint` = `"https://[fda3:e29:9416:af10:db46:b477:354e:416e]:8070/blink.bin"`
*(Refer to [Thread Connectivity Prerequisites](#thread-connectivity-prerequisites) for details on obtaining this IPv6 address, which belongs to the HTTP(S) server host PC and is accessible by the end device.)*
> **Note:**
> Thread network throughput is typically lower than Wi-Fi or Ethernet. It is recommended to start with a small OTA binary such as `blink.bin` from `examples/get-started/blink` to validate connectivity.
## Troubleshooting
* Check that your PC can ping the "ESP-Dev-Board" using its IP, and that the IP, AP and other configuration settings are correctly configured in menuconfig
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Advanced HTTPS OTA example
@@ -0,0 +1,7 @@
CONFIG_OPENTHREAD_ENABLED=y
# CMAC is required for openthread
CONFIG_MBEDTLS_CMAC_C=y
# ESP32-H2 requires larger OTA partitions for this example
CONFIG_PARTITION_TABLE_TWO_OTA_LARGE=y
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Native OTA example
@@ -0,0 +1,4 @@
CONFIG_OPENTHREAD_ENABLED=y
# CMAC is required for openthread
CONFIG_MBEDTLS_CMAC_C=y
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Encrypted Binary OTA
@@ -0,0 +1,4 @@
CONFIG_OPENTHREAD_ENABLED=y
# CMAC is required for openthread
CONFIG_MBEDTLS_CMAC_C=y
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Simple OTA example
@@ -50,6 +50,12 @@ menu "Example Configuration"
depends on EXAMPLE_CONNECT_ETHERNET
help
Select ethernet interface to pass the OTA data.
config EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_THREAD
bool "Bind thread interface"
depends on EXAMPLE_CONNECT_THREAD
help
Select Thread interface to pass the OTA data.
endchoice
config EXAMPLE_TLS_DYN_BUF_RX_STATIC
@@ -36,6 +36,8 @@
static const char *bind_interface_name = EXAMPLE_NETIF_DESC_ETH;
#elif CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_STA
static const char *bind_interface_name = EXAMPLE_NETIF_DESC_STA;
#elif CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_THREAD
static const char *bind_interface_name = EXAMPLE_NETIF_DESC_THREAD;
#endif
#endif
@@ -0,0 +1,4 @@
CONFIG_OPENTHREAD_ENABLED=y
# CMAC is required for openthread
CONFIG_MBEDTLS_CMAC_C=y