Merge branch 'update/nvs_example' into 'master'

refactor(nvs_examples): refactor nvs storage examples and add nvs_console example

See merge request espressif/esp-idf!37978
This commit is contained in:
Martin Vychodil
2025-04-07 16:27:06 +08:00
71 changed files with 1020 additions and 493 deletions

View File

@@ -47,16 +47,18 @@ Examples
* - **Code Example**
- **Description**
* - :example:`nvs_rw_blob <storage/nvs_rw_blob>`
* - :example:`nvs_rw_blob <storage/nvs/nvs_rw_blob>`
- Shows the use of the C-style API to read and write blob data types in NVS flash.
* - :example:`nvs_rw_value <storage/nvs_rw_value>`
* - :example:`nvs_rw_value <storage/nvs/nvs_rw_value>`
- 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_rw_value_cxx>`
* - :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_bootloader <storage/nvs_bootloader>`
* - :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/nvsgen>`
* - :example:`nvsgen <storage/nvs/nvsgen>`
- Demonstrates how to use the Python-based NVS image generation tool to create an NVS partition image from the contents of a CSV file.
* - :example:`nvs_console <storage/nvs/nvs_console>`
- Demonstrates how to use NVS through an interactive console interface.
.. list-table:: Common Filesystem API
:widths: 25 75

View File

@@ -37,7 +37,7 @@ Applications are expected to follow the steps below in order to enable decryptio
Application Example
-------------------
You can find code examples in :example:`storage/nvs_bootloader` (in the :example:`storage` directory of ESP-IDF examples).
You can find code examples in :example:`storage/nvs/nvs_bootloader` (in the :example:`storage/nvs` directory of ESP-IDF examples).
This section demonstrates how to prepare data in the input-output structure for various data types, namespaces, and keys. It includes an example of reading string data from NVS.

View File

@@ -154,9 +154,9 @@ If ``FLASH_IN_PROJECT`` is not specified, the image will still be generated, but
Application Example
-------------------
You can find code examples in the :example:`storage` directory of ESP-IDF examples:
You can find code examples in the :example:`storage/nvs` directory of ESP-IDF examples:
:example:`storage/nvs_rw_value`
:example:`storage/nvs/nvs_rw_value`
Demonstrates how to read a single integer value from, and write it to NVS.
@@ -164,7 +164,7 @@ You can find code examples in the :example:`storage` directory of ESP-IDF exampl
The example also shows how to check if a read/write operation was successful, or if a certain value has not been initialized in NVS. The diagnostic procedure is provided in plain text to help you track the program flow and capture any issues on the way.
:example:`storage/nvs_rw_blob`
:example:`storage/nvs/nvs_rw_blob`
Demonstrates how to read a single integer value and a blob (binary large object), and write them to NVS to preserve this value between {IDF_TARGET_NAME} module restarts.
@@ -173,9 +173,9 @@ You can find code examples in the :example:`storage` directory of ESP-IDF exampl
The example also shows how to implement the diagnostic procedure to check if the read/write operation was successful.
:example:`storage/nvs_rw_value_cxx`
:example:`storage/nvs/nvs_rw_value_cxx`
This example does exactly the same as :example:`storage/nvs_rw_value`, except that it uses the C++ NVS handle class.
This example does exactly the same as :example:`storage/nvs/nvs_rw_value`, except that it uses the C++ NVS handle class.
Internals
---------