You can use DCT app section so that the data persists across power cycles. Please refer to snip.dct_read_write to check how the App section is modified.
Yes, I saw the snip.dct_read_write project.
But the example seems to have to use dct predefined(like
What I want to do is dynamically save and store data in flash.
Can I use sflash_read/write API?
1 of 1 people found this helpful
You can use wiced_dct_write() to store data during runtime in DCT section of flash. The string_var in the example is modified during runtime. The dct_read_write_app_dct_t struct in the example is user defined. Similarly you can have your own struct or you can simply store other data types in DCT dynamically. Using API to directly write to SFlash is not recommended because the SFlash has a well defined memory layout and if you write data into a dedicated section (such as bootloader), you may risk corrupting that section.
Oh, I see. Thank you for answer
If so, which API should I use if I want to delete all the data in the flash's DCT_APP_SECTION?
There is only read/write in the dct API.
You can set the value of each member of the structure to 0 and write this in DCT. This should be done between wiced_dct_read_lock() and wiced_dct_read_unlock().