From a9c014d91564d86231ecf71d38abe622bef5412b Mon Sep 17 00:00:00 2001 From: Dhaval Gujar Date: Thu, 16 Apr 2026 15:47:56 +0530 Subject: [PATCH] Add ESP-IDF 6.0 compatibility fixes --- components/esp-openclaw-node/CMakeLists.txt | 6 ++++++ components/esp-openclaw-node/idf_component.yml | 2 +- .../esp-openclaw-node/src/esp_openclaw_node_identity.c | 4 ++-- .../main/esp_openclaw_node_example_adc_node_cmd.c | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/components/esp-openclaw-node/CMakeLists.txt b/components/esp-openclaw-node/CMakeLists.txt index f1c2301..0638147 100644 --- a/components/esp-openclaw-node/CMakeLists.txt +++ b/components/esp-openclaw-node/CMakeLists.txt @@ -20,3 +20,9 @@ set(esp_openclaw_node_component_args ) idf_component_register(${esp_openclaw_node_component_args}) + +# Work around the IDF 6.0/newlib-picolibc Annex K header breakage in the +# managed libsodium component without affecting the rest of the build. +if(TARGET __idf_espressif__libsodium) + target_compile_definitions(__idf_espressif__libsodium PRIVATE __STDC_WANT_LIB_EXT1__=0) +endif() diff --git a/components/esp-openclaw-node/idf_component.yml b/components/esp-openclaw-node/idf_component.yml index 42dda17..6b6d5e2 100644 --- a/components/esp-openclaw-node/idf_component.yml +++ b/components/esp-openclaw-node/idf_component.yml @@ -12,4 +12,4 @@ dependencies: espressif/esp_websocket_client: version: "1.6.1" espressif/libsodium: - version: "1.0.20~4" + version: "1.0.21" diff --git a/components/esp-openclaw-node/src/esp_openclaw_node_identity.c b/components/esp-openclaw-node/src/esp_openclaw_node_identity.c index b8caf0c..92b7ee9 100644 --- a/components/esp-openclaw-node/src/esp_openclaw_node_identity.c +++ b/components/esp-openclaw-node/src/esp_openclaw_node_identity.c @@ -16,7 +16,7 @@ #include "esp_log.h" #include "esp_random.h" #include "mbedtls/base64.h" -#include "mbedtls/sha256.h" +#include "sha/sha_parallel_engine.h" #include "nvs.h" #include "sodium.h" @@ -241,7 +241,7 @@ esp_err_t esp_openclaw_node_identity_load_or_create(esp_openclaw_node_identity_t } uint8_t digest[32] = {0}; - mbedtls_sha256(identity->public_key, ESP_OPENCLAW_NODE_ED25519_PUBLIC_KEY_LEN, digest, 0); + esp_sha(SHA2_256, identity->public_key, ESP_OPENCLAW_NODE_ED25519_PUBLIC_KEY_LEN, digest); bytes_to_lower_hex(digest, sizeof(digest), identity->device_id, sizeof(identity->device_id)); err = base64url_encode( identity->public_key, diff --git a/examples/esp32-node/main/esp_openclaw_node_example_adc_node_cmd.c b/examples/esp32-node/main/esp_openclaw_node_example_adc_node_cmd.c index ce8ab30..5845f4e 100644 --- a/examples/esp32-node/main/esp_openclaw_node_example_adc_node_cmd.c +++ b/examples/esp32-node/main/esp_openclaw_node_example_adc_node_cmd.c @@ -16,7 +16,6 @@ #include "esp_check.h" #include "esp_openclaw_node_example_json.h" #include "soc/adc_channel.h" -#include "soc/adc_periph.h" #include "soc/soc_caps.h" #if SOC_ADC_SUPPORTED @@ -134,7 +133,10 @@ static esp_err_t handle_adc_read( cJSON_AddNumberToObject(payload, "unit", 1); cJSON_AddNumberToObject(payload, "channel", channel_num); cJSON_AddNumberToObject(payload, "raw", raw); - cJSON_AddNumberToObject(payload, "gpio", adc_channel_io_map[0][channel_num]); + int gpio_num = -1; + if (adc_oneshot_channel_to_io(ADC_UNIT_1, adc_channel, &gpio_num) == ESP_OK) { + cJSON_AddNumberToObject(payload, "gpio", gpio_num); + } if (adc->adc_cali_ready[channel_num]) { int mv = 0; if (adc_cali_raw_to_voltage(adc->adc_cali[channel_num], raw, &mv) == ESP_OK) {