I placed a file icon.gif (size 4614 bytes) in the data subdir of my project.
Then used PlatformIO Project Tasks > esp32dev > Platform > Build Filesystem Image and Upload Filesystem Image to upload the file.
I had a look at the source to verify that LVGL indeed has all callback functions implemented for STDIO.
I’m sure I’m missing something very obvious, but right now I’m stumped.
so it seems there is no binding fopen() ↔ SPIFFS.open(). And if you just call fopen("icon.gif", "rb") file will not open. I don’t know how to configure PlatfomIO to link stdio with SPIFFS (if this is possible).
Maybe somebody will help with it.
Anyway you can use lv_fs - driver . In this case you need ro realize open(), close(), read() function which will use SPIFFS.open/close/read functions. Here, here, here some examples.
Your are correct. So in this case when you call lv_fs_open()fs_open() from lv_fs_stdio.c called, where in turn fopen(buf, flags) is called. But it seems the problem is that the fopen()does not open the file from SPIFFS. Maybe there is some option in IDE to configure stdio to use SPIFFS.
Ok, at least I have an explanation for the LV_FS_RES_UNKNOWN I think.
After including stdlib.h I now get an LV_FS_RES_NOT_EX, which makes sense if STDIO is not supported.
Did a (partial) implementation of an SPIFFS driver.
Things were very confusing, as all examples I had were using different (older?) function signatures. lv_img_set_src with a file from “disk” is now working