Commit graph

37 commits

Author SHA1 Message Date
Jakob Hasse
98b1da9e60 NVS: more graceful behavior for erasing partitions 2020-04-03 11:48:07 +08:00
Jakob Hasse
c6deffb8a2 NVS Flash: prevent erasing initialized partition
Closes https://github.com/espressif/esp-idf/issues/4755
Closes https://github.com/espressif/esp-idf/issues/2777

* nvs_flash_erase_partition() checks whether
  the parition in question is initialized
  already and will return an error if so
* reflect changes in the documentation
2020-02-19 18:16:04 +01:00
Jakob Hasse
c75ec644f4 NVS: Changed all new to new (nothrow) 2020-01-15 14:01:35 +08:00
Jakob Hasse
d286876d34 NVS: expose C++ API
Closes https://github.com/espressif/esp-idf/issues/3540
2020-01-09 18:29:23 +08:00
Jakob Hasse
c31c45cae7 NVS: partition name is copied now
Closes IDF-1231
2020-01-02 09:18:24 +08:00
Jakob Hasse
5249d33c1f NVS: bugfix nvs_set_str/blob checks write mode 2019-12-18 09:06:45 +08:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
MartinValik
5268960235 Added support for NVS iterators
Closes https://github.com/espressif/esp-idf/issues/129
2019-06-10 16:42:39 +02:00
GOPTIONS\pfrost
897bb55482 nvs: Append _t to nvs_handle & nvs_open_mode types
Merges https://github.com/espressif/esp-idf/pull/3239/
2019-05-22 02:53:28 +00:00
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
Sagar Bijwe
d32128440d nvs_flash: Detect key partition as uninitialised even if encrypted by bootloader
Currently, only erase operation performed by the application leads
to detection of NVS key partition as uninitialised. This change
adds additional checks for detecting partition as uninitialised,
when device boots first time right after encryption by bootloader.
2019-02-01 13:28:13 +05:30
Sagar Bijwe
48fccbf5dd nvs_flash: Add support for nvs encryption 2018-09-24 11:25:21 +05:30
Paul Reimer
c83c3b64cd Add declarations of private nvs functions (nvs_*) in nvs_flash component to fix C++ -Wmissing-declarations warning
Merges https://github.com/espressif/esp-idf/pull/1956
2018-06-04 16:36:44 +10:00
Ivan Grokhotkov
20405fbbcc nvs: make nvs_flash_deinit useable from unit tests 2018-04-16 14:06:52 +08:00
konstantin
c93626db3f nvs:Add functions for calculating used/free entries
Users needs functions to count the number of free and used entries.

1. `nvs_get_stats()` This function return structure of statistic about the uspace NVS.
(Struct: used_entries, free_entries, total_entries and namespace_count)
2. `nvs_get_used_entry_count()` The second function return amount of entries in the namespace (by handler)
3. Added unit tests.

Closes TW<12282>
2018-04-13 10:34:13 +05:00
Ivan Grokhotkov
ab13db0e45 nvs: fix nvs_flash_init_partition initializing default partition
Fixes https://github.com/espressif/esp-idf/issues/1052.

Ref TW15698.
2017-10-13 07:19:16 +08:00
Ivan Grokhotkov
fe30789149 nvs_flash: delete Storage if init fails
Previously, nvs_flash_init_custom would not be called if Storage for a
particular partition was already created. This caused issues if the
first call to nvs_flash_init failed due to Storage init error. This issue
exhibited itself as random failures of NVS CI test.

With this change, storage object is deleted (and not added to storage
list) if initialization fails.
2017-09-19 10:39:44 +08:00
Ivan Grokhotkov
f32b25ebe2 nvs_flash: add functions to deinitialize storage 2017-09-19 10:39:44 +08:00
Amey Inamdar
c8945bb82a nvs: minor - removed unused header inclusion
Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
2017-09-18 17:02:32 +05:30
baohongde
87031f9457 component/bt: fix nvs_get_str_or_blob length output error 2017-09-08 12:02:35 +08:00
baohongde
e1bd51af80 component/bt: fix nvs_get_str_or_blob length output error 2017-09-08 12:02:35 +08:00
baohongde
f3be0395d2 component/bt: fix nvs_get_str_or_blob length output error 2017-09-08 12:02:35 +08:00
Amey Inamdar
a2dcf7faa8 nvs: Support for handling multiple NVS partitions
This commit adds support for multiple NVS partitions. This provides application a flexibility to have multiple NVS
partitions such as separate partition with read-only manufacturing data and read-write partition with configuration.
Application can also use this to separate out application's configuration storage from system configuration.

This feature does not change any of the basic property of NVS subsystem. The same-named namespaces across partitions are
considered to be different namespaces. The original NVS API available for the applications remains unchanged. The only
difference is that instead of first NVS partition in the partition table, it now operates on the partition with label
"nvs" (which is default in the IDF provided partition table files). Additional APIs are provided to open a handle and
erase NVS with partition name as a parameter.

A test case is added in the host tests and it is made sure that all the host tests pass. nvs_rw_value app is also tested
with multiple partitions.

Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
2017-08-22 13:48:14 +05:30
Amey Inamdar
3e4e4dd07a nvs_flash: Reduced visibility of handle counter
Monotonically increasing handle counter need not be visible outside the HandleEntry class.

Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
2017-08-22 12:58:56 +05:30
Ivan Grokhotkov
979fce0df5 bt: call nvs_flash_init in examples, show error if NVS is not initialized
NVS is used to store PHY calibration data, WiFi configuration, and BT
configuration. Previously BT examples did not call nvs_flash_init,
relying on the fact that it is called during PHY init. However PHY init
did not handle possible NVS initialization errors.

This change moves PHY init procedure into the application, and adds
diagnostic messages to BT config management routines if NVS is not
initialized.
2017-07-17 21:29:50 +08:00
Ivan Grokhotkov
541b142654 phy_init: reduce the amount of hardwired logic, add coexist init 2016-11-18 20:11:17 +08:00
Ivan Grokhotkov
6e97936bac nvs: allow nvs_flash_init to be called more than once
Also don’t assert in nvs_* functions if nvs_flash_init wasn’t called,
and make nvs_flash_init_custom an internal API for unit tests.
2016-11-18 20:11:16 +08:00
Ivan Grokhotkov
51021b06f8 nvs: initialize using layout from partition table 2016-11-18 20:11:16 +08:00
Liu Zhi Fu
f12be7ebd8 nvs_flash: adjust the nvs_flash start sector number
Modify the nvs flash start sector from 6 to 9
2016-11-17 11:22:20 +08:00
Ivan Grokhotkov
74a658c765 nvs: fix memory leaks in HashList and nvs_close
Fixes TW8162.
Associated test case is run under Instruments on macOS, until I set up valgrind to test this automatically on Linux.
2016-10-26 12:25:53 +08:00
Angus Gratton
a98ab8d801 nvs: Remove flash layout arguments from nvs_init()
Add notes that current NVS layout defaults are a Work In Progress and
not yet integrated with the partition table.
2016-09-27 13:28:45 +10:00
Ivan Grokhotkov
1c7508885c components/nvs: fix build, use log library instead of printf 2016-09-23 09:00:28 +08:00
Ivan Grokhotkov
2a68f60874 components/nvs: add erase function
This change exposes functions to erase single key and to erase all keys from namespace.
TW6769, TW6839
2016-09-23 08:08:03 +08:00
Ivan Grokhotkov
e87d80d478 components/nvs: fix formatting 2016-09-22 21:05:47 +08:00
Ivan Grokhotkov
7447d08605 components/nvs: clear handles list on init, fix returning *length in nvs_get_{str,blob} 2016-08-23 12:08:00 +08:00
Ivan Grokhotkov
f04c894123 components/nvs: add debugging facilities and runtime checks
Extra runtime sanity checks run when compiled for the host (i.e. with no ESP_PLATFORM define)
2016-08-23 12:08:00 +08:00
Ivan Grokhotkov
bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00