fix(mbedtls): fix undefined esp_mbedtls_mem_calloc/free at link time

platform.c (compiled into the 'builtin' archive) calls
esp_mbedtls_mem_calloc and esp_mbedtls_mem_free directly by name via
the MBEDTLS_PLATFORM_STD_CALLOC/FREE macros in esp_config.h.
Previously, esp_mem.c was compiled into the 'tfpsacrypto' archive, which
appears after 'builtin' in the link command, causing the linker to fail
with undefined reference errors when 'builtin' was processed first.

Moving esp_mem.c into 'builtin' to assure that the function used by
esp_mbedtls_mem_calloc and esp_mbedtls_mem_free are available when
pltform.c is linked.
This commit is contained in:
Guillaume Souchere
2026-04-09 10:51:21 +02:00
parent 57ad8c89ab
commit e7cf8cd3cb
3 changed files with 15 additions and 5 deletions
-3
View File
@@ -27,10 +27,7 @@ idf_component_register(SRCS "${srcs}"
if(NOT ${IDF_TARGET} STREQUAL "linux")
# Increase link multiplicity to get some lwip symbols correctly resolved by the linker
# due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls
idf_component_get_property(lwip lwip COMPONENT_LIB)
set_property(TARGET ${lwip} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 5)
else()
# For linux target, define ESP_TLS_WITH_LWIP if LWIP is enabled in the build
if(CONFIG_LWIP_ENABLE)