Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FDS Example - so what does "freeable words" actually mean?

Even immediately after issuing a gc (garbage collect) command, "freeable words" is still 1022:

fds example:~$ stat

total pages:    2
total records:  3
valid records:  1
dirty records:  2
largest contig: 1024
freeable words: 1031 (4124 bytes)
reserved words: 0
used     words: 2

fds example:~$ gc
<info> app: Event: FDS_EVT_GC received (FDS_SUCCESS)
fds example:~$ stat
total pages:    2
total records:  2
valid records:  1
dirty records:  1
largest contig: 1024
freeable words: 1022 (4088 bytes)
reserved words: 0
used     words: 2

fds example:~$

Why?

What does this number actually mean?

The documentation just says,

The largest number of words that can be reclaimed by garbage collection.

The actual amount of space freed by garbage collection might be less than this value if records are open while garbage collection is run.

But, even after doing delete all, and gc, it is still 1022:

fds example:~$ delete_all
<info> app: Deleting next record.
<info> app: Event: FDS_EVT_DEL_RECORD received (FDS_SUCCESS)
<info> app: Record ID:  0x0015
<info> app: File ID:    0xF010
<info> app: Record key: 0x7010
<info> app: Deleting next record.
<info> app: No records left to delete.
fds example:~$ gc
<info> app: Event: FDS_EVT_GC received (FDS_SUCCESS)
fds example:~$ stat
total pages:    2
total records:  1
valid records:  0
dirty records:  1
largest contig: 1024
freeable words: 1022 (4088 bytes)
reserved words: 0
used     words: 2
fds example:~$

Why?

If they are "freeable" - why does gc not free them??!

Parents Reply
  • Just as shown, I think.

    In my real app (on a different board), the initialisation was failing with FD_ERROR_NO_PAGES.

    I've just tried doing a complete chip erase, then reprogramming the SD and app - and that error goes away!

    So it looks like the FDS is (or can be) sensitive to what's been in flash before?

    I'll have to try the full erase & reprogram with the example ...

Children
Related