Merge branch 'feat/nvs_iteration_statistics_examples_v6.0' into 'release/v6.0'

feat(examples/storage): add nvs statistics and iteration examples (v6.0)

See merge request espressif/esp-idf!43660
This commit is contained in:
Martin Vychodil
2025-12-01 02:29:06 +08:00
20 changed files with 756 additions and 0 deletions

View File

@@ -53,6 +53,10 @@ Examples
- Shows the use of the C-style API to read and write integer data types in NVS flash.
* - :example:`nvs_rw_value_cxx <storage/nvs/nvs_rw_value_cxx>`
- Shows the use of the C++-style API to read and write integer data types in NVS flash.
* - :example:`nvs_statistics <storage/nvs/nvs_statistics>`
- Shows the use of the C-style API to obtain NVS usage statistics: free/used/available/total number of entries and number of namespaces in given NVS partition.
* - :example:`nvs_iteration <storage/nvs/nvs_iteration>`
- Shows the use of the C-style API to iterate over entries of specific (or any) NVS data type and how to obtain info about such entries.
* - :example:`nvs_bootloader <storage/nvs/nvs_bootloader>`
- Shows the use of the API available to the bootloader code to read NVS data.
* - :example:`nvsgen <storage/nvs/nvsgen>`

View File

@@ -177,6 +177,22 @@ You can find code examples in the :example:`storage/nvs` directory of ESP-IDF ex
This example does exactly the same as :example:`storage/nvs/nvs_rw_value`, except that it uses the C++ NVS handle class.
:example:`storage/nvs/nvs_statistics`
This example demonstrates how to obtain and interpret NVS usage statistics: free/used/available/total number of entries and number of namespaces in given NVS partition.
Default NVS partition is erased for a clean run of this example. Then mock data string values are written.
Usage statistics are obtained prior to and post writing, with the differences being compared to expected values of newly used entries.
:example:`storage/nvs/nvs_iteration`
This example demonstrates how to iterate over entries of specific (or any) NVS data type and how to obtain info about such entries.
Default NVS partition is erased for a clean run of this example. Then mock data consisting of different NVS integer data types are written.
After that, the example iterates over each individual data type as well as the generic ``NVS_TYPE_ANY`` type, and logs the information obtained from each iteration.
Internals
---------