Lines Matching +full:flash +full:- +full:id
3 Non-Volatile Storage (NVS)
6 Elements, represented as id-data pairs, are stored in flash using a
7 FIFO-managed circular buffer. The flash area is divided into sectors. Elements
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
14 at least one id-data pair stored in flash at all time.
19 Each element is stored in flash as metadata (8 byte) and data. The metadata is
22 of: id, data offset in sector, data length, part (unused), and a CRC. This CRC is
25 CRC-32. Use the :kconfig:option:`CONFIG_NVS_DATA_CRC` configuration item to enable
36 of the metadata. Data that is written in flash without metadata is ignored
39 During initialization NVS will verify the data stored in flash, if it
42 NVS checks the id-data pair before writing data to flash. If the id-data pair
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
52 .. code-block:: c
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
66 the flash erase page size and a power of 2.
67 - ``NVS_SECTOR_COUNT`` is the number of sectors, it is at least 2, one
69 - ``NVS_STORAGE_OFFSET`` is the offset of the storage area in flash.
72 Flash wear
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
88 Each write of the state variable requires 12 bytes of flash storage: 8 bytes
99 - ``NS`` as the number of storage requests per minute,
100 - ``DS`` as the data size in bytes,
101 - ``SECTOR_SIZE`` in bytes, and
102 - ``PAGE_ERASES`` as the number of times the page can be erased,
111 Flash write block size migration
113 It is possible that during a DFU process, the flash driver used by the NVS
115 The NVS in-flash image will stay compatible unless the
117 Especially, migration between 1,2,4,8-bytes write block sizes is allowed.
127 MPU fault while using NVS, or ``-ETIMEDOUT`` error returned
128 NVS can use the internal flash of the SoC. While the MPU is enabled,
129 the flash driver requires MPU RWX access to flash memory, configured
132 the internal SoC flash and it's the only thread running. In a
133 multi-threaded application, another thread might intercept the fault
134 and the NVS API will return an ``-ETIMEDOUT`` error.