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 <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PVWMiHQifoYXL7uL3bphrZ
This commit is contained in:
Joeandclaude-flow committed 2026-09-10 14:13:46 -04:00
1 parent f06c644b36
commit 2ab3300fd9
2 files changed
+20 -1

No files matched your search

+9 -1
View File
@@ -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")
@@ -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"