Hello,
To start off, here are the details of my project:
Xilinx Zynq-7000 on a custom board
64GB eMMC card for storage
Latest FreeRTOS source from the Git repo
Latest FreeRTOS+TCP and an older version of +FAT
At its core, my project is a data logger that is storing data in binary log files and running an FTP server to send those log files to a base station.
The expectation is that the storage will never get full as log files will be pulled from the device on a regular basis using the FTP server and will then be deleted from the FS. However, I do have to plan for the worst case which means the logs keep on piling up and if the storage is full, I want to delete the oldest file in the FS and use the freed up space for the latest one.
Currently, based on Hein’s recommendations in a different forum post, I am creating a binary log file of a fixed size and filling it with 0s before using it for logging. Each file is configured for a size of 512 bytes. Once it is full, the file is closed and new one is created.
I also have timestamping implemented. My project is using an RTC so I had to modify the ff_time.c file to suit my RTC driver but the FS is now able to correctly tag the files with a valid timestamp.
So my question is that is it possible to somehow search the FS for the “oldest” file so that it can be deleted? And question 2 is that will the FS become slow once the files start piling up? Based on some rough math, I could have as many as ~128,000 files stored on the FS (64GB / 512B).
I am open to any suggestions to make a better implementation of my logging mechanism too.
Thank you for your help,
Sid