Rtos API example

Embed: (wiki syntax)

« Back to documentation index

example5.cpp File Reference

example5.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 5 Notes

This 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
  • flushes the KV to flash again
  • uninitialises
  • initialises
  • opens KV for reading.
  • deletes KV
  • closes KV.
  • 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 Example5 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 example5.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_EXAMPLE5_APP` e.g. `mbed compile -v -m K64F -t GCC_ARM -DCFSTORE_EXAMPLE5_APP`.

Definition in file example5.cpp.