[En-Nut-Discussion] Uflashfs and NUTSERIALFLASH->sf_used issue

Wojciech Niziński niziak at spox.org
Fri Jul 12 10:35:38 CEST 2013

I'm using uflashfs filesystem with 2112 kB serial data flash. Flash is 
handled by driver "flashAT45dib0".
Flash organisation is 4096 pages * 528 bytes.

I found that sometimes "fread" reads less bytes than I requested (and less 
that was previously written by "fwrite").

Digging more deeply I found that curret implementation of 
NUSERIALFLASH->sf_used is using pattern 0xFF to detect   free space inside 
flash unit (flash page). Thus size of every previously written block of data 
which ends with sequence of 0xFF will be reported incorrectly.

My current workaround is to add one byte more at end of data during write 
and ignore it during read.

Concept of implementation of sf_used functions should be redesigned i.e. 
used size can be stored inside each page like CRC.

Best Regards
Wojciech Niziński 

More information about the En-Nut-Discussion mailing list