From 2ab3300fd94b9255fba4bcb52aaefc4b32fde16b Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 10 Sep 2026 14:13:46 -0400 Subject: [PATCH] fix(firmware): source cJSON from the component manager on ESP-IDF 6 cJSON ships as the bundled `json` component through 5.x and moved out to the component manager in v6, where requiring it fails outright: Failed to resolve component 'json' required by component 'main': unknown name. Requiring it unconditionally kept the 5.4 lane green while breaking the 6.0.2 lane -- one toolchain is not the build matrix. `json` is now required only when IDF_VERSION_MAJOR < 6, and `espressif/cjson` is declared in idf_component.yml under an `idf_version >=6.0` rule so the two never coexist in one build. Verified building on esp32c6/16MB with ESP-IDF 5.4. Co-Authored-By: claude-flow Claude-Session: https://claude.ai/code/session_01PVWMiHQifoYXL7uL3bphrZ --- firmware/esp32-csi-node/main/CMakeLists.txt | 10 +++++++++- firmware/esp32-csi-node/main/idf_component.yml | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/firmware/esp32-csi-node/main/CMakeLists.txt b/firmware/esp32-csi-node/main/CMakeLists.txt index 38c4c4074..2a2b21cb6 100644 --- a/firmware/esp32-csi-node/main/CMakeLists.txt +++ b/firmware/esp32-csi-node/main/CMakeLists.txt @@ -23,7 +23,6 @@ set(SRCS # ESP-IDF v6+: headers must resolve via explicit REQUIRES (no implicit deps). set(REQUIRES - json esp_wifi esp_netif esp_event @@ -59,6 +58,15 @@ if(IDF_VERSION_MAJOR GREATER_EQUAL 6) list(APPEND REQUIRES esp_driver_tsens) endif() +# cJSON (config_api.c) ships as the bundled `json` component up to ESP-IDF 5.x +# and was moved OUT to the component manager in v6, where requiring `json` +# fails outright: "Failed to resolve component 'json' required by component +# 'main': unknown name." Declaring it unconditionally broke the v6.0.2 lane +# while the 5.4 lane stayed green -- one toolchain is not the build matrix. +if(IDF_VERSION_MAJOR LESS 6) + list(APPEND REQUIRES json) +endif() + # ADR-061: Mock CSI generator for QEMU testing + ADR-081 mock radio binding if(CONFIG_CSI_MOCK_ENABLED) list(APPEND SRCS "mock_csi.c" "rv_radio_ops_mock.c") diff --git a/firmware/esp32-csi-node/main/idf_component.yml b/firmware/esp32-csi-node/main/idf_component.yml index 4ec1d552a..af4a7bcc4 100644 --- a/firmware/esp32-csi-node/main/idf_component.yml +++ b/firmware/esp32-csi-node/main/idf_component.yml @@ -11,3 +11,14 @@ dependencies: ## Onboard WS2812 LED Disabling espressif/led_strip: "^3.0.0" + + ## cJSON for config_api.c. + ## Bundled as the `json` component up to ESP-IDF 5.x and moved out to the + ## component manager in v6, so it is pulled ONLY on the v6+ lane -- on 5.4 + ## `main/CMakeLists.txt` requires the built-in `json` instead. Taking it from + ## the registry on 5.x as well would mean two cJSON implementations in one + ## build. + espressif/cjson: + version: "^1.7.19" + rules: + - if: "idf_version >=6.0"