Skip to content

Commit 7d349d3

Browse files
author
Amanda Butler
authored
Merge pull request #399 from davidsaada/david_nvstore
Add documentation for NVStore
2 parents 18e7c72 + 547a165 commit 7d349d3

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

docs/reference/api/storage/NVStore.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## NVStore
2+
3+
NVStore is a lightweight module that stores data by keys in the internal flash for security purposes. For each item key, the NVStore module provides the ability to set the item data or get it. Newly added values are added to the end of the existing data, superseding the previous value that was there for the same key. The NVStore module ensures that power failures don't harm existing data during any operation.
4+
5+
### Flash structure
6+
7+
NVStore uses two Flash areas, active and nonactive. Each area must consist of at least one erasable unit (sector). Data is written to the active area until it becomes full. When it does, garbage collection is invoked. This compacts items from the active area to the nonactive one and switches activity between areas. Each item is kept in an entry containing a header and data, where the header holds the item key, size and CRC.
8+
9+
### NVStore class reference
10+
11+
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/nvstore_8h_source.html)
12+
13+
### NVStore example
14+
15+
[![View code](https://www.mbed.com/embed/?url=http://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-nvstore)](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-nvstore/file/0a3e19b12855/main.cpp/)

docs/reference/configuration/Storage.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,36 @@ Name: littlefs.enable_error
9595
Defined by: library:littlefs
9696
Macro name: MBED_LFS_ENABLE_ERROR
9797
Value: null (set by library:littlefs)
98+
99+
Name: nvstore.max_keys
100+
Description:
101+
Maximal number of allowed NVStore keys.
102+
Defined by: library:nvstore
103+
Macro name: NVSTORE_MAX_KEYS
104+
Value: 16 (set by library:nvstore)
105+
Name: nvstore.area_1_address
106+
Description:
107+
Address of the first NVStore area in flash.
108+
Defined by: library:nvstore
109+
Macro name: NVSTORE_AREA_1_ADDRESS
110+
Value: null (set by library:nvstore)
111+
Name: nvstore.area_1_size
112+
Description:
113+
Size of the first NVStore area in flash.
114+
Defined by: library:nvstore
115+
Macro name: NVSTORE_AREA_1_SIZE
116+
Value: null (set by library:nvstore)
117+
Name: nvstore.area_2_address
118+
Description:
119+
Address of the second NVStore area in flash.
120+
Defined by: library:nvstore
121+
Macro name: NVSTORE_AREA_2_ADDRESS
122+
Value: null (set by library:nvstore)
123+
Name: nvstore.area_2_size
124+
Description:
125+
Size of the second NVStore area in flash.
126+
Defined by: library:nvstore
127+
Macro name: NVSTORE_AREA_2_SIZE
128+
Value: null (set by library:nvstore)
129+
98130
```

0 commit comments

Comments
 (0)