One file always takes one block (4kB) with littleFS?

Hi.

After 3 days I've finally got littleFS working on a custom nRF52840 board. I am using nRF connect SDK v2.9.0 which includes Zephyr v3.7.99 with some additional Nordic diffs.

I've configured the partitions (static partitioning) so that littleFS has 11*4kB of internal Flash available in total (4kB is size of one internal Flash sector).
All great and I can upload and download files via MCUmgr. Happy me.
However I've got surprised after exactly 11 files, which in total were ~12kB, I could no longer upload any more files and MCUmgr returned error "Error occurred whilst attempting to write data to a file". After some digging around I have noticed that every time I upload a file it takes up one whole block (4kB!!!) even if the file is merely 1kB or less in size.

What am I doing wrong? I expect that with 45kB I can upload 45kB (minus the FS management overhead) of files. Is this not possible with littleFS and every file just takes up the whole block regardless of size? What should I do? I am on a very memory constrained application.

Parents Reply Children
No Data
Related