NVStore example for Mbed OS. This is an example of an application that uses the NVStore APIs. The application invokes the NVStore APIs and prints the results after each such invocation.

Required hardware

# Other hardware

Although the board shown in this examples is K64F, the example should work on any Mbed enabled hardware supporting the internal flash driver (has "FLASH" in the "device_has" in targets/target.json file).

Getting started

1. Import the example.

``` mbed import mbed-os-example-nvstore cd mbed-os-example-nvstore ```

2. Keep the default NVStore configuration, which uses the last two sectors (4KB each) as NVStore areas.

3. Compile and generate binary.

For example, for `GCC`:

``` mbed compile -t GCC_ARM -m K64F ```

4. Open a serial console session with the target platform using the following parameters:

  • Baud rate: 115200
  • Data bits: 8
  • Stop bits: 1
  • Parity: None

5. Copy the application `mbed-os-example-nvstore.bin` in the folder `mbed-os-example-nvstore/BUILD/<TARGET NAME>/<PLATFORM NAME>` onto the target board.

6. Press the RESET button on the board to run the program

7. The serial console should now display a series of results following the NVStore API invocations.

8. Now copy `mbed_app-8KB-areas.json` to `mbed_app.json`. This should use 8KB areas (two pairs of last sectors) as NVStore areas.

9. Repeat steps 3-7. Notice the changes in prints of area addresses and sizes and with the amount of possible keys this configuration can hold.

10. To restore the default configuration, copy `mbed_app-default-areas.json` to `mbed_app.json`.

Troubleshooting

If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.

Committer:
mbed_official
Date:
Mon Jun 03 15:02:15 2019 +0100
Revision:
29:226b38fd84c6
Parent:
3:60267c5e2348
Merge pull request #40 from 0xc0170/fix_license

add contributing + license files
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-nvstore

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 2:0a3e19b12855 1 {
mbed_official 2:0a3e19b12855 2 "target_overrides": {
mbed_official 2:0a3e19b12855 3 "*": {
mbed_official 2:0a3e19b12855 4 "platform.stdio-baud-rate": 115200,
mbed_official 3:60267c5e2348 5 "platform.default-serial-baud-rate": 115200,
mbed_official 3:60267c5e2348 6 "platform.stdio-convert-newlines": 1
mbed_official 2:0a3e19b12855 7 },
mbed_official 2:0a3e19b12855 8 "K64F": {
mbed_official 2:0a3e19b12855 9 "nvstore.max_keys": 20,
mbed_official 2:0a3e19b12855 10 "nvstore.area_1_address": "0xFC000",
mbed_official 2:0a3e19b12855 11 "nvstore.area_1_size" : "0x2000",
mbed_official 2:0a3e19b12855 12 "nvstore.area_2_address": "0xFE000",
mbed_official 2:0a3e19b12855 13 "nvstore.area_2_size" : "0x2000"
mbed_official 2:0a3e19b12855 14 }
mbed_official 2:0a3e19b12855 15 }
mbed_official 2:0a3e19b12855 16 }