Page 1 of 1

Virtual file system FatFS address

Posted: Thu Oct 06, 2022 9:58 am
by pepopi
Hello,

I am doing a project using the vfs and I have a question. Having different subdirectories and files, how can I know the address of each file saved in the vfs?

Thank you

Re: Virtual file system FatFS address

Posted: Thu Oct 06, 2022 12:39 pm
by ESP_igrr
Hi peopi,

The direct answer to your question is "it's not possible to know".

It's probably better if you explain what you want to achieve, which requires you to know the address of the file.


The address of a particular file in Flash is something we can consider to be internal business of FAT library. The file might be located anywhere in the FAT partition. It's only important that the FAT library can find the file when you call "fopen" and access its data when you call "fread" or "fwrite". Besides, since the FAT partition is wrapped in a wear levelling container, the individual sectors in the partition might be shuffled according to the wear levelling algorithm. Just like in the case with FAT, it's not important where each particular sector ends up, it's only important that the wear levelling library knows how to find this sector.