mbed-os/libraries/fs
Olivier Martin 2251b0267d libraries/fs: Added logic to transparently sync written file
fflush() does not do anything in mbed library. The only time the file
was flushed was when it was closed.
For some applications (eg: data logger), files are never closed. It
means when the power went off all the written data were lost.
Actually, they were not lost; they were written into the non-volatile
storage. But the file header was not aware of these new data (its
file information such as file size were not updated).

There is no easy way to retarget fflush() for mbed. So, the workaround
is to fflush (eg: 'sync' in the ChaN terminology) periodically
while writting new data.

The frequency can be changed by the user into ffconf.h.
By default, the updated file will be synced for every new sector (generally
for every 512 bytes). Another available option is to sync for every
new cluster (in my use case, the cluster was 8 sectors long).
2014-02-21 09:57:23 +00:00
..
fat libraries/fs: Added logic to transparently sync written file 2014-02-21 09:57:23 +00:00
sd Merge pull request #168 from oliviermartin/om/sd-fix-when-no-card-present 2014-02-18 10:47:11 +00:00