SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

httpd with spiffs #391

Open SaimenSays opened 7 years ago

SaimenSays commented 7 years ago

Hi!

Is it possible to use extras/httpd with an existing spiffs easily? I cant' find any define switch which allows me to compile without files stored in fsdata.c?

lujji commented 7 years ago

Hi. You can start by enabling LWIP_HTTPD_CUSTOM_FILES flag and implementing your own fs_open_custom() and fs_close_custom() functions in fs.c. I've been planning to add SPIFFS integration for quite a while, but never had enough free time..

SaimenSays commented 7 years ago

This is not as easy as it looks on first sight!

The whole file needs to be in an RAM buffer, because there is no explicit read function. On fs_open_custom() the whole file needs to be copied in a buffer. Because of known RAM problematic, this is not possible. Also there is no file handle managed in struct fs_file. Because you need one for spiffs handling an additional list needs to be build. ...

I think the only possible way to go, is rewriting httpd.c for demands of spiffs.