ESP_FAULT_ASSERT(C) was silently deleted by the optimizer when C is a cached
flag/status already proven by a preceding `if (!C) return/goto`: the compiler
folds C to a constant and drops all three checks, removing the fault-injection
protection with no warning.
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
Add a test app that verifies PLACE_IN_SECTION, _SECTION_ATTR_SYMBOL_DECL_GENERIC,
_SECTION_START and _SECTION_END macros work correctly on Linux.
The test places 5 uint32_t values into a custom .test_data_table section from
two separate translation units, then iterates the section at runtime to verify
the correct count and content of all entries.
Includes:
- Custom linker script (ld/test_section.ld)
- Build-test-rules entry (linux only)
- pytest host_test marker
Add PLACE_IN_SECTION, _SECTION_ATTR_IMPL_GENERIC, _SECTION_ATTR_SYMBOL_DECL_GENERIC,
_SECTION_START and _SECTION_END macros that emit real section attributes on every
platform (embedded ELF, Linux ELF, macOS Mach-O).
Unlike _SECTION_ATTR_IMPL which is a no-op on Linux, these macros work uniformly
across all targets, enabling link-time arrays for error-code tables, init-function
arrays, and similar patterns.
Also moves _COUNTER_STRINGIFY definition before its first use.
In commit a0bcffcc, some ESP_RETURN and ESP_GOTO debug macros were
introduced. But this caused a regression with CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT
case. Its better to move this macros to HTTP client component itself, as
the debug log is still desired for the specific use-case.
This commit replace macro MEM_CHECK with return on failure and
updated usage of reespctive APIs' in IDF.
This also update th prototype of API esp_http_client_add_auth().
Closes https://github.com/espressif/esp-idf/issues/14463
__VA_NARG__ is copied from a forum post and is a pretty common implementation
with a high chance of causing naming collision
Added ESP_ namespace to avoid this.
Merges https://github.com/espressif/esp-idf/pull/12093
fix(ll): remove FLAG_ATTR macro
Such kind of operator overload will not work because C++ thinks such overload is ambiguous and it still prefer the built-in one which accepts and returns integer. Manually force type conversion seems to be unavoidable.