Skip to content

Commit

Permalink
ESP32: Remove esp32_mbedtls component(v1.1 cherry-pick of PR 26608 an…
Browse files Browse the repository at this point in the history
…d PR 26750) (#26779)

* ESP32: use mbedtls config in IDF

* esp32: remove esp32_mbedtls component

* Add CONFIG_MBEDTLS_HKDF_C=y to some esp32 defaults. (#26750)

This seems to be required, otherwise I get errors like:

```
config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:330: undefined reference to `mbedtls_hkdf'
```

Co-authored-by: Andrei Litvin <andreilitvin@google.com>

* Remove 'CONFIG_MBEDTLS_HKDF_C=y' for sdkconfig.defaults.<target-name> files

---------

Co-authored-by: Andrei Litvin <andy314@gmail.com>
Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
3 people committed May 24, 2023
1 parent 20daa6d commit 3267ef3
Show file tree
Hide file tree
Showing 36 changed files with 160 additions and 2,559 deletions.
75 changes: 63 additions & 12 deletions config/esp32/components/chip/CMakeLists.txt
Expand Up @@ -335,22 +335,17 @@ target_include_directories(${COMPONENT_LIB} INTERFACE
"${CHIP_ROOT}/config/esp32/${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/../../"
)

idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)

idf_build_get_property(idf_target IDF_TARGET)
set(target_name "${idf_target}")

if(CONFIG_BT_ENABLED)
idf_component_get_property(bt_lib bt COMPONENT_LIB)
if("${CONFIG_IDF_TARGET}" STREQUAL "esp32h2")
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a)
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c2")
if((target_name STREQUAL "esp32h2") OR (target_name STREQUAL "esp32c2") OR (target_name STREQUAL "esp32c6"))
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a)
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c6")
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a)
list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
else()
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
endif()
Expand Down Expand Up @@ -386,9 +381,65 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
list(APPEND chip_libraries $<TARGET_FILE:${esp32_secure_cert_mgr_lib}>)
endif()

idf_component_get_property(lwip_lib lwip COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${lwip_lib}>)


if (CONFIG_ESP_WIFI_ENABLED)
idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB)
idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${esp_wifi_lib}>)
if (CONFIG_IDF_TARGET_ESP32C2)
set(blobs core net80211 pp)
else()
set(blobs core mesh net80211 pp)
endif()

foreach(blob ${blobs})
list(APPEND chip_libraries "${esp_wifi_dir}/lib/${target_name}/lib${blob}.a")
endforeach()
endif()

idf_component_get_property(esp_netif_lib esp_netif COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_netif_lib}>)

idf_component_get_property(esp_hw_support_lib esp_hw_support COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_hw_support_lib}>)

idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB)
idf_component_get_property(esp_phy_dir esp_phy COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${esp_phy_lib}>)

if (CONFIG_IDF_TARGET_ESP32)
set(phy_blobs phy rtc)
elseif (CONFIG_IDF_TARGET_ESP32S2)
set(phy_blobs phy)
else()
set(phy_blobs phy btbb)
endif()
foreach(phy_blob ${phy_blobs})
list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a")
endforeach()

idf_component_get_property(esp_event_lib esp_event COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_event_lib}>)

idf_component_get_property(hal_lib hal COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${hal_lib}>)

idf_component_get_property(esp_system_lib esp_system COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_system_lib}>)

idf_component_get_property(soc_lib soc COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${soc_lib}>)

idf_component_get_property(efuse_lib efuse COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${efuse_lib}>)

target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
${chip_libraries}
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:${esp32_mbedtls_lib}>
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:mbedx509>
$<TARGET_FILE:${mbedtls_lib}>
-Wl,--end-group)

# Make the component dependent on our CHIP build
Expand Down
3 changes: 0 additions & 3 deletions config/esp32/components/esp32_mbedtls/CMakeLists.txt

This file was deleted.

191 changes: 0 additions & 191 deletions config/esp32/components/esp32_mbedtls/hkdf.c

This file was deleted.

0 comments on commit 3267ef3

Please sign in to comment.