esp-idf/docs/en/api-reference/storage/nvs_flash.rst
Jakob Hasse 5dbca18324 [doc]: NVS documentation updates
* Better comment of nvs_get_used_entry_count()
* Mention C++ example in API reference
* WIP: Used target instead of hard code ESP32
* Note that strings can only span one page
* Reflect that item types have been moved
* Some clarification about nvs_commit()
* Improved reference to the ESP Partition API
* fixed little mistake in documenting-code.rst
* Change of nvs_open_from_part() to
  nvs_open_from_partition() reflected in docs
* Corrected documentation of
  NVSHandle::get_string(), NVSHandle::get_blob()
  and NVSHandle::get_item_size().

* Closes IDF-1563
* Closes IDF-859
* Closes https://github.com/espressif/esp-idf/issues/6123
2021-06-02 15:46:13 +08:00

43 lines
2.0 KiB
ReStructuredText

.. include:: ../../../../components/nvs_flash/README.rst
NVS Partition Generator Utility
-------------------------------
This utility helps generate NVS partition binary files which can be flashed separately on a dedicated partition via a flashing utility. Key-value pairs to be flashed onto the partition can be provided via a CSV file. For more details, please refer to :doc:`NVS Partition Generator Utility <nvs_partition_gen>`.
Application Example
-------------------
You can find two code examples in the :example:`storage` directory of ESP-IDF examples:
:example:`storage/nvs_rw_value`
Demonstrates how to read a single integer value from, and write it to NVS.
The value checked in this example holds the number of the {IDF_TARGET_NAME} module restarts. The value's function as a counter is only possible due to its storing in NVS.
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`
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.
* value - tracks the number of the {IDF_TARGET_NAME} module soft and hard restarts.
* blob - contains a table with module run times. The table is read from NVS to dynamically allocated RAM. A new run time is added to the table on each manually triggered soft restart, and then the added run time is written to NVS. Triggering is done by pulling down GPIO0.
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`
This example does exactly the same as :example:`storage/nvs_rw_value`, except that it uses the C++ nvs handle class.
API Reference
-------------
.. include-build-file:: inc/nvs_flash.inc
.. include-build-file:: inc/nvs.inc