I have an esp8266 with 2024kb spi size.
I'm adding html pages support to this example https://github.com/OLIMEX/ESP8266/tree/master/IoT%20Firmware/olimex#sthash.VWmtfyuD.dpuf, based on this one https://github.com/OLIMEX/ESP8266/tree/master/esphttpd.
Basically it creates a compressed file with all the html/images/javascript/css and in runtime it decompress and serves the request.
It means that in the end, I end up with 3 images to flash:
user1.bin
user2.bin
webpages.espf (the compressed html)
In the original code of the 2nd example they flash the html to 0x12000 but they use non boot mode compilation meaning that they flash the eagle.flash.bin to 0x00000 and the eagle.irom0text.bin to 0x40000. It works.
But in the example n1 only works with boot mode meaning that I flash the user1.bin to 0x01000 and the user2.bin to 0x81000. When I flash the html to 0x12000 it stops working.
I've tried some research and I saw an address that some people were using for other stuff. 0x78000. So I tried it and now the esp8266 runs my program. The problem is that the code cannot find the html. Here is a piece of the code:
//user_config.h
#define ESPFS_POS 0x78000
//user_myfile.c
//Open a file and return a pointer to the file desc struct.
EspFsFile ICACHE_FLASH_ATTR *espFsOpen(char *fileName) {
char *p=(char *)(ESPFS_POS+0x40200000);
char *hpos;
char namebuf[256];
EspFsHeader h;
EspFsFile *r;
//Strip initial slashes
while(fileName[0]=='/') fileName++;
//Go find that file!
while(1) {
hpos=p;
//Grab the next file header.
os_memcpy(&h, p, sizeof(EspFsHeader));
if (h.magic!=0x73665345) {
os_printf("Magic mismatch. EspFS image broken.\n");
return NULL;
}
if (h.flags&FLAG_LASTFILE) {
os_printf("End of image.\n");
return NULL;
}
//[......]
The debug always prints "Magic mismatch. EspFS image broken.\n".
I appreciate any help that you can provide me. Thanks in advance.