docs: Added a mention of read-only NVS in filesystem considerations document

This commit is contained in:
Adam Múdry
2025-05-02 14:26:20 +02:00
parent 6897f90612
commit e0be50d9b5
2 changed files with 14 additions and 0 deletions

View File

@ -173,11 +173,18 @@ Points to keep in mind when developing NVS related code:
* The NVS library cannot ensure data consistency in out-of-spec power environments, such as systems powered by batteries or solar panels. Misinterpretation of flash data in such situations can lead to corruption of the NVS flash partition. Developers should include data recovery code, e.g., based on a read-only data partition with factory settings.
* An initialized NVS library leaves a RAM footprint, which scales linearly with the overall size of the flash partitions and the number of cached keys.
**Read-only NVS partitions:**
* Read-only partitions can be used to store data that should not be modified at runtime. This is useful for storing firmware or configuration data that should not be changed by the application.
* NVS partitions can be flagged as ``readonly`` in the partition table CSV file. Size of read-only NVS partition can be as small as one page (4 KiB/``0x1000``), which is not possible for standard read-write NVS partitions.
* Partitions of sizes ``0x1000`` and ``0x2000`` are always read-only and partitions of size ``0x3000`` and above are always read-write capable (still can be opened in read-only mode in the code).
**Related documents:**
- To learn more about the API and NVS library details, see the :doc:`NVS documentation page <../api-reference/storage/nvs_flash>`.
- For mass production, you can use the :doc:`NVS Partition Generator Utility <../api-reference/storage/nvs_partition_gen>`.
- For offline NVS partition analysis, you can use the :doc:`NVS Partition Parser Utility <../api-reference/storage/nvs_partition_parse>`.
- For more information about read-only NVS partitions, see the :ref:`Read-only NVS <read-only-nvs>`.
**Examples:**

View File

@ -173,11 +173,18 @@ NVS 具有如下特性:
* NVS 库无法在不符合规格的电源环境中确保一致性例如使用电池或太阳能面板供电的系统。在这种情况下flash 数据的错误解析可能会导致 NVS flash 分区损坏。开发者应提供数据恢复代码,例如,基于具有工厂设置的只读数据分区。
* 已初始化的 NVS 库会占用 RAM 空间,这个占用量随着 flash 分区和缓存的键数量的增加线性增长。
**只读 NVS 分区:**
* 只读分区可用于存储运行时不应被修改的数据,例如固件或配置数据。
* 可以在分区表 CSV 文件中将 NVS 分区标记为 ``readonly``。只读 NVS 分区的最小尺寸可以小至一页4 KiB/``0x1000``),而标准读写 NVS 分区则无法设置如此小的尺寸。
* ``0x1000````0x2000`` 大小的分区始终为只读分区,而大小为 ``0x3000`` 及以上的分区则支持读写(在代码中仍可以只读模式打开)。
**相关文档:**
- 有关 API 和 NVS 库的更多信息,请参阅 :doc:`非易失性存储库 <../api-reference/storage/nvs_flash>`
- 有关批量生产的信息,请参阅 :doc:`NVS 分区生成程序 <../api-reference/storage/nvs_partition_gen>`
- 有关离线 NVS 分区解析的信息,请参阅 :doc:`NVS 分区解析程序 <../api-reference/storage/nvs_partition_parse>`
- 有关只读 NVS 分区的信息,请参阅 :ref:`只读 NVS <read-only-nvs>`
**示例:**