Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
example3.cpp File Reference
Test case to demonstrate each API function works correctly. More...
Go to the source code of this file.
Detailed Description
Test case to demonstrate each API function works correctly.
- Example 3 Notes
Example3 is a synchronous mode example for creating key-values in the persistent storage.
The flash-journal synchronous mode example test does the following CFSTORE operations:
- initialises
- creates a key-value pair (KV).
- writes the data for the KV
- closes KV.
- flushes the KV to flash
- opens KV for reading.
- reads KV and checks the value blob was the same as previously written.
- closes KV.
- finds a KV (there is only 1 to find).
- for the KV returned, get the key name.
- for the KV returned, get the value length.
- for the KV returned, delete the KV.
- find another KV (which fails as there are no more keys to find).
- flushes the updated state to flash to store the removal of the deleted KV.
- uninitialises
- stops
This test is coded so as to work only in flash journal sync mode i.e. with caps.asynchronous_ops == false
The test leaves the flash in the same state as at the beginning of the test so it can be run a second time on the device without flashing, and the test should still work.
- How to Build Example3 as a Stand-alone Application
This example can be build as a stand-alone application as follows:
- Create a new mbed application using the `mbed new .` command.
- Copy this file example3.cpp from the to the top level application directory and rename the file to main.cpp.
- Build the application with `mbed compile -v -m <target> -t <toolchain> -DCFSTORE_EXAMPLE3_APP` e.g. `mbed compile -v -m K64F -t GCC_ARM -DCFSTORE_EXAMPLE3_APP`.
Definition in file example3.cpp.
Generated on Tue Jul 12 2022 11:03:02 by
