Skip to content

Commit

Permalink
nvs: add documentation about the crc in nvs
Browse files Browse the repository at this point in the history
fixed nvs part of zephyrproject-rtos#68699

Signed-off-by: Laczen JMS <[email protected]>
Co-authored-by: Benjamin Cabé <[email protected]>
  • Loading branch information
2 people authored and MaureenHelm committed Feb 12, 2024
1 parent 66a4fe3 commit c0a72cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doc/services/storage/nvs/nvs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c0a72cf

Please sign in to comment.