- fixed identification of blob parts to be cleaned by using right starting chunk index
- improved localisation of blobs for cases where some of pages get reclaimed
- created host test cases covering the edge cases above
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
NVSEncryptedPartition held two XTS_CONTEXT members (mEctxt, mDctxt) for
encryption / decryption. Their AES round keys are derived from the NVS
encryption key (HMAC-derived or plaintext from nvs_keys partition) and
therefore are sensitive secrets.
The destructor was empty, so when the NVS encrypted partition object
was destroyed -- on nvs_flash_deinit_partition(), on initialization
errors, and on any other teardown path -- the XTS round keys were left
in DRAM until the freed object's memory happened to be overwritten by
a later allocation. A subsequent stack/heap leak primitive would
recover the AES key from those bytes.
Fix:
* Initialize both XTS contexts in the constructor so the destructor's
free path is always safe (previously xts_init was only called in
init(); destruction before init() would have run xts_free on an
uninitialized struct).
* Provide a real destructor that calls XTS_FUNC(xts_free) on both
contexts, which performs mbedtls_platform_zeroize / esp_aes_xts free
semantics on the underlying AES contexts.
Three host_test CMakeLists.txt files relied on idioms tied to a
specific build system layout. Make them portable:
- spiffs/host_test and esp_partition/host_test/partition_api_test
passed a hard-coded "<project>.elf" target name to add_dependencies().
Use ${project_elf}, the canonical variable that resolves to the live
executable target name in either build system.
- nvs_flash/host_test/nvs_page_test linked --coverage using the plain
signature of target_link_libraries. CMake forbids mixing plain and
keyword signatures on the same target; the component library link
already uses the keyword form. Switch the --coverage link to the
keyword signature.
Add a new CMake function esp_partition_flash_binary() that provides a
unified API for registering partition data binaries to be flashed. It
replaces the direct esptool_py_flash_target calls scattered across
components (spiffs, fatfs, nvs_flash) with a single function that:
- Resolves partition offset from the partition table automatically
- Determines encryption requirements (auto-detect or ALWAYS_PLAINTEXT)
- Creates per-partition flash targets (e.g. idf.py <partition>-flash)
- Optionally includes the binary in `idf.py flash` via FLASH_IN_PROJECT
On the linux target, the function registers binaries for pre-loading
into the emulated flash. A build-time manifest (linux_flash_data.txt)
is generated via file(GENERATE), and partition_linux.c reads it at
runtime to copy each binary into the memory-mapped flash buffer at
the correct offset.
The partition_ops example is updated to use the new function and
includes a custom_partition with pre-built data to demonstrate the
full workflow, including on the linux target.
- Added new option NVS_READWRITE_PURGE for nvs_open. All update and erase operations of
the handle are wiping out the content erased items on top of just marking them erased.
- Added new API call nvs_purge_all allowing to wipe out the existing erased items
of the handle.
- Host test were refactored to allow for BDL and non-BDL NVS implementation
- Introduceed `NVSPartitionTestHelper` class replacing `PartitionEmulationFixture`
- Refactored all tests to use `NVSPartitionTestHelper` instead of legacy emulation fixture
- Removed legacy `PartitionEmulationFixture` and `PartitionEmulationFixture2` classes
- Removed `TEMPORARILY_DISABLED` macro usage by reducing partition size in applicable tests
- Enhanced test coverage and readability with comments and validation steps for each TC
- Added utility functions for partition stats tracking, file loading, and erase count check
- BDL provider can be enabled vor NVS in the menuconfig option NVS_BDL_STACK
- Hierarchy of Partition class tree was adjusted and all operations were documented
- Class Partition is now derived from intrusive_list_node and ExceptionlessAllocable
- Class NVSPartition implements only the dual support for esp_partition and BDL
- Class NVSEncryptedPartition implements only encryption related extensions