This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FlashFS fdelete() - does it reclaim free space

Hi All,

I am using FlashFS (MDK-ARM V4.22) with an SPI FLASH (Atmel AT45DB321C) and STM32F207.

My problem is that when I delete files using fdelete() the free space (as reported by ffree()) is _never_ recovered, even though the files disappear from the file list (as reported using repeated calls to finfo()). I can delete ALL the files, and NONE of the space is recovered.

I realise that the FLASH can only be erased a block at a time, and indeed the manual says:

"When the file content is modified, the old file content is invalidated and a new memory block is allocated. The Flash Block is erased when all the data stored in the Flash Block have been invalidated."

This is perfectly reasonable. However, this reclamation of space when an entire block is invalidated never seems to happen; ffree() only ever reports a decreasing amount of free space, and I never hit the breakpoint I set on the SPI driver EraseSector() function.

The only way to recover the space seems to be to call fformat() which, as expected, erases the whole FLASH.

Does anyone have any ideas as to what I might be doing wrong?

Thanks in advance,

Christopher Hicks
==