I'm using the ESP32 aWOT library to setup a webserver and I'd like to embed a bunch of binary files into the firmware .bin image (for OTA update purposes). Using PlatformIO we can use the:
board_build.embed_txtfiles = src/file.ext
command to embed the files to the .bin file. However I didn't figured out how to retrieve the files (either using a file system like SPIFFS or using C/assembly language). The Espressif documentation mentions the extern const uint8_t file_ext_start[] asm("_binary_src_file_ext_start"); command to access the file content, but I didn't understand how to use it.
Supose a file.html is embedded into the .bin and then I wish to route it like 192.168.0.XX/file.html - the aWOT library provides the app.get("/page", &handler); in which the *handler handles the response, but how to reference the embedded html file inside the handler function?
char file_ext_start[] = "blah blah blah";and treat them accordingly (as usual strings defined in a C code) .embed_txtfilesdirective would add extra zero byte to the end of dumped file content for the file to become zero-terminated string in the code. And in case ofembed_fileszero terminated byte is NOT added because you know before hand that file contains arbitrary data and can contain zero byte in the middle of the data sostrcpy,strlenetc are not applicable to such data.