Overview
Non-volatile Data Storage (NVDS) is a lightweight key-value pair data storage system that uses the Flash read/write APIs provided by the Flash Hardware Abstraction Layer (Flash HAL) to store data in Flash memory. It ensures that data will not get lost even if the system is powered off.
NVDS is an ideal choice for storing small blocks of data, for example, application configuration parameters, calibration data, state information, and user information. Bluetooth LE Protocol Stack also stores parameters such as device bonding parameters in NVDS.
NVDS features the following:
- Each storage item (tag) has a unique tag ID. User applications can read and change data according to tag IDs, regardless of physical storage addresses.
- It is optimized based on media characteristics of Flash memory and supports data check, garbage collection, and wear-leveling.
- The size and start address of the NVDS area are configurable. Flash is divided into sectors, with each sector being 4 KB in size. NVDS area can be configured to occupy several sectors, and the start address shall be 4 KB-aligned.
By default, GR54xx SDK uses the last several sectors in Flash for NVDS, with the start address being the Flash end address minus the NVDS area size. You can specify the NVDS start address and the number of sectors by configuring NVDS_START_ADDR and NVDS_NUM_SECTOR in custom_config.h. Note that NVDS_NUM_SECTOR excludes the NVDS garbage collection area. The total number of sectors occupied by NVDS is NVDS_NUM_SECTOR + 1.