From c0a72cfb11f3dbb338376f74427edb2433b4b72e Mon Sep 17 00:00:00 2001 From: Laczen JMS Date: Thu, 8 Feb 2024 12:26:29 +0100 Subject: [PATCH] nvs: add documentation about the crc in nvs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixed nvs part of #68699 Signed-off-by: Laczen JMS Co-authored-by: Benjamin Cabé --- doc/services/storage/nvs/nvs.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/services/storage/nvs/nvs.rst b/doc/services/storage/nvs/nvs.rst index e2a3648e000..8278e49bf71 100644 --- a/doc/services/storage/nvs/nvs.rst +++ b/doc/services/storage/nvs/nvs.rst @@ -19,7 +19,11 @@ combination of these. Each element is stored in flash as metadata (8 byte) and data. The metadata is written in a table starting from the end of a nvs sector, the data is written one after the other from the start of the sector. The metadata consists -of: id, data offset in sector, data length, part (unused) and a crc. +of: id, data offset in sector, data length, part (unused), and a CRC. The CRC is +only calculated over the metadata and only ensures that a write has been +completed. The actual data of the element is not protected by a CRC. It is +encouraged to include a CRC as part of the data and to take appropriate +corrective actions when the data CRC does not match its expected value. A write of data to nvs always starts with writing the data, followed by a write of the metadata. Data that is written in flash without metadata is ignored