Page 1 of 1
some esp_vfs_fat and FatFs functions are unavailable
Posted: Tue Aug 20, 2024 11:45 pm
by kernic
In the documentation, we are told to use the #include "esp_vfs_fat.h" header. then the documentation proceed do define a bunch of functions like esp_vfs_fat_test_contiguous_file, and esp_vfs_fat_create_contiguous_file which I need for performance reasons since I want to allocate a contiguous file for my database project. but unfortunately, it is impossible to call any other function but the bare minimum to mount the sd card (for example the esp_vfs_fat_sdspi_mount() function and the basic f_open() function from fatfs).
I do not understand why after including the "ff.h" header, even the f_expand from fatfs isn't available(since it is available in the offical fatfs doc), and only basic stuff like f_open will work.
same thing with what comes from the esp_vfs_fat.h helper functions, I can just do stuff like esp_vfs_fat_sdspi_mount but again esp_vfs_fat_create_contiguous_file doesn't work.
that would be really nice if I could allocate a contiguous file, thanks for reading
Re: some esp_vfs_fat and FatFs functions are unavailable
Posted: Thu Aug 22, 2024 2:41 pm
by ESP_adokitkat
Hello. Which esp-idf version are you using? It is only available from v5.3 stable branch (or in release/v5.3 or master branch). To make f_expand from fatfs available on lower idf version you have to modify `components/fatfs/src/ffconf.h` from `#define FF_USE_EXPAND 0` to `#define FF_USE_EXPAND 1`.
Re: some esp_vfs_fat and FatFs functions are unavailable
Posted: Thu Aug 22, 2024 11:13 pm
by kernic
I'm pretty sure I had the esp extension in visual studio at 5.3, since I remember downgrading it to 5.0 with no success(these days with the millions lines of code I expect newer versions of software to break, so my first instinct was to downgrade to 5.0 instead of trying to upgrade).
I found out about #define FF_USE_EXPAND 1 after spinning around for 3 hours, I ended up on some stack overflow post about another mcu that said to change the ff.conf for a totally irrelated parameters, but quickly scanning through the ff.conf on github even if I almost missed the #define FF_USE_EXPAND 1 property from a hair, I fortunately saw it and realized it needed to be set to 1 instead of 0.
so then I tried to find the location of ff.conf (I took some env variable and searched its path in the ide) and I was able to turn FF_USE_EXPAND to 1 in ff.conf.
But I don't understand
1) why someone would answer my post at all(I think you are an admin that works for espressif)
2) how you were able to locate my issue instantly and know exactly what my problem was (even with the #define FF_USE_EXPAND 1 and not just tell me to updgrade the idf), I literally struggled for 3 hours and almost missed it
anyway if you could just answer back on 2, Thanks a lot for your answer! I guess you have some pet project too that requires fatfs or maybe you just know about ffconf intuitively because you have a some experience in the field and know to check config files first thing when a func isn't available but should be?
Re: some esp_vfs_fat and FatFs functions are unavailable
Posted: Fri Aug 23, 2024 2:30 pm
by ESP_adokitkat
Well, yes, I am an employee of Espressif, hence "ESP_" in my nickname here
I was able to pinpoint your issue because it was me who enabled FF_USE_EXPAND and added those helper functions to esp-idf (and they were able to make it to release v5.3) after noticing it wasn't enabled before and could have some use.