Skip to content

Commit 3515101

Browse files
authored
ESP32: Use mbedtls component in IDF (#26608)
* ESP32: use mbedtls config in IDF * esp32: remove esp32_mbedtls component
1 parent 0ce378a commit 3515101

34 files changed

+154
-2559
lines changed

config/esp32/components/chip/CMakeLists.txt

+63-12
Original file line numberDiff line numberDiff line change
@@ -332,22 +332,17 @@ target_include_directories(${COMPONENT_LIB} INTERFACE
332332
"${CHIP_ROOT}/config/esp32/${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/../../"
333333
)
334334

335-
idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)
335+
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)
336+
337+
idf_build_get_property(idf_target IDF_TARGET)
338+
set(target_name "${idf_target}")
336339

337340
if(CONFIG_BT_ENABLED)
338341
idf_component_get_property(bt_lib bt COMPONENT_LIB)
339-
if("${CONFIG_IDF_TARGET}" STREQUAL "esp32h2")
340-
idf_component_get_property(bt_dir bt COMPONENT_DIR)
341-
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
342-
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a)
343-
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c2")
342+
if((target_name STREQUAL "esp32h2") OR (target_name STREQUAL "esp32c2") OR (target_name STREQUAL "esp32c6"))
344343
idf_component_get_property(bt_dir bt COMPONENT_DIR)
345344
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
346-
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a)
347-
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c6")
348-
idf_component_get_property(bt_dir bt COMPONENT_DIR)
349-
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
350-
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a)
345+
list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
351346
else()
352347
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
353348
endif()
@@ -383,9 +378,65 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
383378
list(APPEND chip_libraries $<TARGET_FILE:${esp32_secure_cert_mgr_lib}>)
384379
endif()
385380

381+
idf_component_get_property(lwip_lib lwip COMPONENT_LIB)
382+
list(APPEND chip_libraries $<TARGET_FILE:${lwip_lib}>)
383+
384+
385+
if (CONFIG_ESP_WIFI_ENABLED)
386+
idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB)
387+
idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR)
388+
list(APPEND chip_libraries $<TARGET_FILE:${esp_wifi_lib}>)
389+
if (CONFIG_IDF_TARGET_ESP32C2)
390+
set(blobs core net80211 pp)
391+
else()
392+
set(blobs core mesh net80211 pp)
393+
endif()
394+
395+
foreach(blob ${blobs})
396+
list(APPEND chip_libraries "${esp_wifi_dir}/lib/${target_name}/lib${blob}.a")
397+
endforeach()
398+
endif()
399+
400+
idf_component_get_property(esp_netif_lib esp_netif COMPONENT_LIB)
401+
list(APPEND chip_libraries $<TARGET_FILE:${esp_netif_lib}>)
402+
403+
idf_component_get_property(esp_hw_support_lib esp_hw_support COMPONENT_LIB)
404+
list(APPEND chip_libraries $<TARGET_FILE:${esp_hw_support_lib}>)
405+
406+
idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB)
407+
idf_component_get_property(esp_phy_dir esp_phy COMPONENT_DIR)
408+
list(APPEND chip_libraries $<TARGET_FILE:${esp_phy_lib}>)
409+
410+
if (CONFIG_IDF_TARGET_ESP32)
411+
set(phy_blobs phy rtc)
412+
elseif (CONFIG_IDF_TARGET_ESP32S2)
413+
set(phy_blobs phy)
414+
else()
415+
set(phy_blobs phy btbb)
416+
endif()
417+
foreach(phy_blob ${phy_blobs})
418+
list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a")
419+
endforeach()
420+
421+
idf_component_get_property(esp_event_lib esp_event COMPONENT_LIB)
422+
list(APPEND chip_libraries $<TARGET_FILE:${esp_event_lib}>)
423+
424+
idf_component_get_property(hal_lib hal COMPONENT_LIB)
425+
list(APPEND chip_libraries $<TARGET_FILE:${hal_lib}>)
426+
427+
idf_component_get_property(esp_system_lib esp_system COMPONENT_LIB)
428+
list(APPEND chip_libraries $<TARGET_FILE:${esp_system_lib}>)
429+
430+
idf_component_get_property(soc_lib soc COMPONENT_LIB)
431+
list(APPEND chip_libraries $<TARGET_FILE:${soc_lib}>)
432+
433+
idf_component_get_property(efuse_lib efuse COMPONENT_LIB)
434+
list(APPEND chip_libraries $<TARGET_FILE:${efuse_lib}>)
435+
386436
target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
387437
${chip_libraries}
388-
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:${esp32_mbedtls_lib}>
438+
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:mbedx509>
439+
$<TARGET_FILE:${mbedtls_lib}>
389440
-Wl,--end-group)
390441

391442
# Make the component dependent on our CHIP build

config/esp32/components/esp32_mbedtls/CMakeLists.txt

-3
This file was deleted.

config/esp32/components/esp32_mbedtls/hkdf.c

-191
This file was deleted.

0 commit comments

Comments
 (0)