mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Refactor the esp_err_to_name() system to decouple esp_common from higher-level components. Instead of a monolithic generated table, each component registers its error codes into a dedicated linker section (.esp_err_msg_table) via idf_define_esp_err_codes() in its CMakeLists.txt. New files: - tools/err_codes_extract.py: extract ESP_ERR_* defines from headers to CSV - tools/err_codes_to_c.py: generate C source placing entries into linker section - tools/err_codes_to_rst.py: generate RST documentation from error codes - tools/cmake/err_codes.cmake: CMake module providing idf_define_esp_err_codes() - components/esp_common/include/esp_err_codes.h: esp_err_msg_t typedef - components/esp_common/src/esp_err_to_name_new.c: new lookup using link-time array - tools/test_apps/build_system/err_codes_check/: CI test app Changes: - Remove all optional component dependencies from esp_common/CMakeLists.txt - Add .esp_err_msg_table section to all 5 linker scripts - Register error codes in 18 components via idf_define_esp_err_codes() - Add new scripts to .gitlab/ci/rules.yml build_check patterns - use new scripts to generate doc and add CI validation - Update esp_err.rst to add description of composable code registration
43 lines
1.3 KiB
CMake
43 lines
1.3 KiB
CMake
set(srcs esp_tls.c esp-tls-crypto/esp_tls_crypto.c esp_tls_error_capture.c esp_tls_platform_port.c)
|
|
if(CONFIG_ESP_TLS_USING_MBEDTLS)
|
|
list(APPEND srcs
|
|
"esp_tls_mbedtls.c")
|
|
endif()
|
|
|
|
if(CONFIG_ESP_TLS_CUSTOM_STACK)
|
|
list(APPEND srcs
|
|
"esp_tls_custom_stack.c")
|
|
endif()
|
|
|
|
set(priv_req http_parser esp_timer)
|
|
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
|
list(APPEND priv_req lwip)
|
|
else()
|
|
# For linux target on Build system v2, add lwip to PRIV_REQUIRES when CONFIG_LWIP_ENABLE is set.
|
|
if(CONFIG_LWIP_ENABLE AND IDF_BUILD_V2)
|
|
list(APPEND priv_req lwip)
|
|
endif()
|
|
endif()
|
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} esp-tls-crypto
|
|
PRIV_INCLUDE_DIRS "private_include"
|
|
REQUIRES mbedtls
|
|
PRIV_REQUIRES ${priv_req})
|
|
|
|
idf_define_esp_err_codes(HEADERS esp_tls_errors.h)
|
|
|
|
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
|
idf_component_get_property(lwip lwip COMPONENT_LIB)
|
|
else()
|
|
# For linux target, define ESP_TLS_WITH_LWIP if LWIP is enabled in the build
|
|
if(CONFIG_LWIP_ENABLE)
|
|
target_compile_definitions(${COMPONENT_LIB} PRIVATE ESP_TLS_WITH_LWIP=1)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
if(CONFIG_ESP_TLS_USE_SECURE_ELEMENT)
|
|
idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib)
|
|
endif()
|