Rtos API example
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 Sun Jul 17 2022 08:25:34 by 1.7.2