5 years, 10 months ago.

LittleFS

Hi

I have some questions about the implementation on little fs:

1.) If i would prefer to work only with the native api and leave POSIX/Newlib out of the play, do i still get the same functionality? Or otherwise said, i know i dont, for example, if i would like to scan a line for a integer, i just have sscanf... So, is it suggested to use the "non-native-api"??

2.) i really dont understand the read and write API. how can i read 1 line? how can i tell the function WHICH line i would like to read? Same for write, where do i write to? always at the end??

Example: My use case:

I would like to have file as circular buffer, where i add lines until i have a certain file size, then, i start again at the first line and overwrite the first line, but keep the following lines.

First Write: Line 1: ID;001;VALUE;0x1234; << PTR HERE

Second Write: Line 1: ID;001;VALUE;0x1234; Line 2: ID;001;VALUE;0x1444; << PTR HERE

3th Write: Line 1: ID;001;VALUE;0x1234; Line 2: ID;001;VALUE;0x1444; Line 3: ID;001;VALUE;0x12214; << PTR HERE

File Size Reached, start all over

4th Write: Line 1: ID;001;VALUE;0x1234; << PTR HERE Line 2: ID;001;VALUE;0x1444; Line 3: ID;001;VALUE;0x12214;

...

3.) I use internal chip flash with my own block device. When i add new data to my file, what actually happens? does it 'A' just write to flash the new data, or does it 'B' copy current data to ram, add my data, and write data into new section?

Be the first to answer this question.