Lines Matching refs:is
7 FIFO-managed circular buffer. The flash area is divided into sectors. Elements
8 are appended to a sector until storage space in the sector is exhausted. Then a
9 new sector in the flash area is prepared for use (erased). Before erasing the
10 sector it is checked that identifier - data pairs exist in the sectors in use,
11 if not the id-data pair is copied.
13 The id is a 16-bit unsigned number. NVS ensures that for each used id there is
19 Each element is stored in flash as metadata (8 byte) and data. The metadata is
20 written in a table starting from the end of a nvs sector, the data is
22 of: id, data offset in sector, data length, part (unused), and a CRC. This CRC is
28 .. note:: The data CRC is checked only when the whole data of the element is read.
29 The data CRC is not checked for a partial read, as it is stored at the end of the
36 of the metadata. Data that is written in flash without metadata is ignored
43 is unchanged no write to flash is performed.
45 To protect the flash area against frequent erases it is important that there is
47 endless loop of flash page erases when there is limited free space. When such
48 a loop is detected NVS returns that there is no more space available.
50 For NVS the file system is declared as:
63 - ``NVS_FLASH_DEVICE`` is a reference to the flash device that will be used. The
65 - ``NVS_SECTOR_SIZE`` is the sector size, it has to be a multiple of
67 - ``NVS_SECTOR_COUNT`` is the number of sectors, it is at least 2, one
68 sector is always kept empty to allow copying of existing data.
69 - ``NVS_STORAGE_OFFSET`` is the offset of the storage area in flash.
75 When writing data to flash a study of the flash wear is important. Flash has a
76 limited life which is determined by the number of times flash can be erased.
77 Flash is erased one page at a time and the pagesize is determined by the
84 Suppose we use a 4 bytes state variable that is changed every minute and
91 minutes, the second sector is full. When this happens, because we're using
108 From this formula it is also clear what to do in case the expected life is too
113 It is possible that during a DFU process, the flash driver used by the NVS
117 Especially, migration between 1,2,4,8-bytes write block sizes is allowed.
122 A sample of how NVS can be used is supplied in ``samples/subsys/nvs``.
128 NVS can use the internal flash of the SoC. While the MPU is enabled,
130 using :kconfig:option:`CONFIG_MPU_ALLOW_FLASH_WRITE`. If this option is