mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +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
32 lines
1.3 KiB
CMake
32 lines
1.3 KiB
CMake
idf_build_get_property(target IDF_TARGET)
|
|
|
|
if(${target} STREQUAL "linux")
|
|
return() # This component is not supported by the POSIX/Linux simulator
|
|
endif()
|
|
|
|
if(NOT CONFIG_NVS_SEC_KEY_PROTECT_NONE)
|
|
if(BOOTLOADER_BUILD)
|
|
set(srcs "nvs_bootloader_sec_provider.c")
|
|
else()
|
|
set(srcs "nvs_sec_provider.c")
|
|
endif()
|
|
endif()
|
|
|
|
idf_component_register(SRCS ${srcs}
|
|
INCLUDE_DIRS include
|
|
PRIV_REQUIRES bootloader_support efuse esp_partition nvs_flash
|
|
REQUIRES esp_security)
|
|
|
|
idf_define_esp_err_codes(HEADERS include/nvs_sec_provider.h)
|
|
|
|
# NOTE: In a case where only the default NVS partition is to be encrypted
|
|
# and no custom NVS partitions exist, `nvs_flash_init` is the only API that
|
|
# needs to be called. No API from the `nvs_sec_provider` component is called
|
|
# as neither the `nvs_flash` component nor the user app depends on it.
|
|
# Thus, the symbols from this component are not placed in the .map file and
|
|
# hence the constructor, which initialises the encryption scheme for the default
|
|
# NVS partition, never executes. The following is a workaround for the same.
|
|
if(NOT CONFIG_NVS_SEC_KEY_PROTECT_NONE)
|
|
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u nvs_sec_provider_include_impl")
|
|
endif()
|