53 Commits

Author SHA1 Message Date
radek.tandler a5443bbb94 feat(nvs_flash): Added support for storing flash and double types
- added backward compatibility test for unknown NVS entry types
 - axtended documentation with the support of double and float
2026-03-31 19:02:43 +02:00
radek.tandler d50c7b4b6b feat(nvs_flash): Added purging of erased items at namespace level
- 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.
2026-02-05 11:07:43 +01:00
radek.tandler bbfe8e7492 refactor(nvs_flash): NVS Host tests cleaned-up and test cases commented
- 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
2025-12-02 15:32:14 +01:00
radek.tandler 191ac74dd0 feat(nvs_flash): Added support for Block Data Layer storage provider
- 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
2025-12-02 15:32:10 +01:00
radek.tandler 801091c079 refactor(nvs_flash): NVS constants were consolidated
- Constant definitions depending on spi_flash were added to nvs_constants
2025-10-02 12:39:37 +02:00
radek.tandler 96f4f78054 ci(nvs_flash): Enabled nvs_host_test in ci 2025-09-16 20:45:25 +02:00
radek.tandler ccb455fc63 fix(nvs_flash): Fixed host test case when legacy compatibility mode is enabled 2025-09-16 20:45:25 +02:00
radek.tandler 0f5c963a03 fix(nvs_flash): Host test adopted to the new clang initializer rules 2025-09-16 20:45:08 +02:00
Marek Fiala 9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
Radek Tandler 0b8f661c08 Merge branch 'bugfix/storage_nvs_key_overwrite' into 'master'
fix(nvs): fixed erasing of old values if new data type is not the same

Closes IDFGH-14832

See merge request espressif/esp-idf!37888
2025-04-10 20:01:35 +08:00
radek.tandler d9bc77e422 fix(nvs): fixed erasing of old values if new data type is not the same
Closes https://github.com/espressif/esp-idf/issues/15559
2025-04-10 10:55:51 +02:00
Peter Macko 4a1ea4b725 5.5: Update ubuntu base image for esp-env-v5.5 to 24.04, with fixed pipelines 2025-03-31 20:11:57 +08:00
Tomáš Rohlínek be6e24370f fix(storage/nvf_flash): fixup additions from PR 2025-03-28 12:57:33 +01:00
Marius Vikhammer f65dc668a9 test(nvs): fixed wrong volatile qualifier in host-test 2025-03-21 09:30:37 +08:00
igor.udot daf2d31008 test: format all test scripts 2025-03-05 12:08:48 +08:00
radek.tandler 6a23790608 remove(nvs_flash/test_nvs_host): Old make based host tests removed after complete migration 2024-10-01 15:25:27 +02:00
Sonika Rathi d5da858cd9 refactor: remove dependency on spi_flash include for sector size 2024-09-26 13:01:24 +08:00
radek.tandler b937cb7549 fix(storage/nvs): Fixed hadling of inconsistent values in NVS entry header
feat(storage/nvs): Added test cases for damaged entries with correct CRC
2024-08-20 10:57:24 +02:00
Jakob Hasse eb0e894d94 refactor(nvs_flash): Use gcovr instead of lcov for host-based page test 2024-06-25 19:21:54 +02:00
Adam Múdry 8e43afef3b fix(nvs): Fix possible collision with app trace sysview defines
Global.h defines U8, I8, U16, etc. symbols, which are also used in NVS
as a part of custom enum class and this can cause a compilation error
during macro expansion, when sysview is enabled and FreeRTOS.h is included in NVS
2024-04-12 13:46:51 +02:00
Ivan Grokhotkov 10cc15b150 fix(storage): applied spelling fixes by codespell pre-commit hook 2024-03-28 13:00:54 +01:00
radek.tandler 8740888967 feat(nvs_flash): Added function nvs_find_key
Closes https://github.com/espressif/esp-idf/issues/12155
2023-12-08 17:12:00 +01:00
Ivan Grokhotkov 88e77ba1ed ci(nvs_flash): upgrade to Catch2 as a component, fix warnings 2023-11-29 12:38:47 +01:00
radek.tandler d4aa9ccb0c change(nvs_flash): Host tests were migrated from CMock to esp_partition linux emulation 2023-10-13 13:17:28 +02:00
Adam Múdry ab1eb37fe8 feat(partition_table): Add read-only partition flag and functionality 2023-10-11 00:01:05 +02:00
radek.tandler 4f659b70e1 fix(nvs_flash): fixed failing nvs_page test 2023-09-26 15:05:20 +00:00
radek.tandler e8992f500c fix(nvs_flash): nvs_set with same key and different data type
Function now always rewrites old value under same key
regardless existing data type. Users requiring old API behaviour
can enable it by kconfig option CONFIG_NVS_LEGACY_DUP_KEYS_COMPATIBILITY
2023-09-26 15:05:20 +00:00
Cody P Schafer f2af1c5305 nvs: support iteration over namespace by index
Users of the nvs API are likely to have `nvs_handle_t` in all cases, but
not all of them carry around the partition name and namespace name (as
they aren't needed after creating an `nvs_handle_t`).

Allow this common case to use nvs iteration without them tracking
additional data by using the `nvs_handle_t` to locate the namespace
index and the partition name by introducing an alterate to
`nvs_entry_find` called `nvs_entry_find_in_handle`, which operates
similarly except that it is given a `nvs_handle_t` instead of partition
and namespace strings.

This is somewhat more limited than the `nvs_entry_find` API as one
cannot examine all keys in a given partition.
2023-08-29 13:59:34 +02:00
Martin Vychodil e44d4260ad Merge branch 'feature/storage_host_test_nvs_flash2' into 'master'
nvs_flash: finished migration of host tests to the linux emulator of esp_partition

See merge request espressif/esp-idf!23926
2023-08-28 20:20:16 +08:00
radek.tandler 28f82d8de7 refactor(nvs_flash): Host test migrated to esp_partition emulation for linux 2023-08-09 14:14:21 +02:00
radek.tandler ac6c03fad1 change(nvs_flash): nvs_get_stats extended, API documentation improved 2023-08-08 08:43:19 +02:00
Cody P Schafer cbe906e53c nvs_host_test: replace sprintf with snprintf
With some libc impls (ie: Xcode 13.1), sprintf is marked as deprecated
and causes the build with `-Werror` to fail. Switch the `sprintf` usage
in test_nvs.cpp to use `snprintf` to allow builds to complete without
warning.
2023-04-03 16:33:57 -04:00
Jakob Hasse bed81f450d ci(nvs_flash): Increase timeout of nvs_page_test
* nvs_page_test runs into timeout in CI. According to log,
  test ran run around halfway, so increasing from 10 to 90 seconds.

* Also increased timeout of nvs_host_test, just to be sure
2023-02-13 12:35:52 +08:00
Martin Vychodil a2b0068478 Merge branch 'bugfix/linux_build_errors' into 'master'
fix(linux): fix build errors without --skip-setting-flags

See merge request espressif/esp-idf!22063
2023-01-20 14:46:36 +08:00
Ivan Grokhotkov cef0744299 Merge branch 'bugfix/linux_target_gen_partition_table' into 'master'
multiple fixes for linux target

Closes IDF-6641

See merge request espressif/esp-idf!21993
2023-01-18 11:57:08 +08:00
Jakob Hasse 9991862a10 fix(linux): fix build errors and warnings, remove ignore file 2023-01-18 09:24:28 +08:00
Fu Hanxi b02687a6c4 test: migrate linux target host test jobs into pytest-embedded 2023-01-16 10:25:55 +08:00
Ivan Grokhotkov e7540dbe0e docs: remove the outdated "IDF monitor doesn't work on linux" notes 2023-01-13 08:14:56 +01:00
Ivan Grokhotkov ec8f38c9da build system: generate the partition table by default for linux target
This fixes the issue that "idf.py partition-table" had to be run
manually in order for the partition table to be generated, when
building for linux target.
2023-01-13 08:14:56 +01:00
Jakob Hasse 91f04aa877 refactor(nvs): custom allocator for all objects allocated in NVS 2022-12-05 18:59:33 +01:00
radek.tandler ca7f073e7b nvs_flash/host_test: migrated to the CMake build system and nvs flash Linux implementation
Host tests of nvs_flash eligible to run in Linux implementation of nvs flash were migrated. Remaining test cases
were left in original folder. Migrated test cases use CMake instead of make.
2022-11-16 14:15:23 +01:00
Martin Vychodil c9c7573f71 Storage: Partition APIs moved to the new component 'esp_partition'
All the partition handling API functions and data-types were moved from the 'spi_flash' component to the new one named 'esp_partition'. See Storage 5.x migration guide for more details
2022-11-02 21:54:45 +01:00
Ivan Grokhotkov c392c06216 cmake: remove -D prefix from COMPILE_DEFINITIONS property
Unlike COMPILE_OPTIONS, COMPILE_DEFINITIONS CMake property assumes
values without the -D prefix, such as NAME or NAME=VAL.
Previously, IDF build system was passing COMPILE_DEFINITIONS build
property to CMake COMPILE_OPTIONS property, so -D prefix was not
a problem.
Now that COMPILE_DEFINITIONS CMake property is used, -D prefix has
to be removed.

(Note that this doesn't affect 'target_compile_definitions' function,
which strips -D prefix before adding the definition to the property.)
2022-09-20 11:08:02 +02:00
Shubham Kulkarni 3689035b7c tests: Fix CI build failures 2022-08-03 05:18:37 +00:00
Fu Hanxi c0568611dd docs: changes docs supported targets tables 2022-07-14 08:26:32 +08:00
Djordje Nedic facab8c5a7 tools: Increase the minimal supported CMake version to 3.16
This updates the minimal supported version of CMake to 3.16, which in turn enables us to use more CMake features and have a cleaner build system.
This is the version that provides most new features and also the one we use in our latest docker image for CI.
2022-06-01 06:35:02 +00:00
Matus Fabo 58cca07104 add: Kconfig assert or errorcode option
add: private include header
add: macro encapsulation for assertion or error check
add: ESP_FAIL return code documentation in public headers
change: replaced all assertions by NVS_ASSERT_OR_RETURN macro
change: few internal function return values from void to esp_err_t
change: ESP_ERR_NVS_VALUE_TOO_LONG macro comment
2022-05-28 20:29:05 +02:00
Jakob Hasse 46e59e7194 [mocks]: moved already added spi_flash mocks
[nvs]: page test works with new overriden mock

[spi_flash]: Removed mocking code from CMake

* Renamed nvs test to be consistent with other
  host test
2021-08-18 11:05:51 +08:00
Jakob Hasse 7029f0537e [build system]: Fixed common requirement for Linux 2021-08-13 16:50:29 +08:00
Jakob Hasse de6b54de66 [nvs_flash]: Entries with state == 1 don't crash 2021-07-30 18:33:27 +08:00