I'm trying to work with SPIFFS in ESP8266 Arduino.
I'm using ESP-01 generic moduke with 512K SPI flash.
In the eagle file I found, that start address for SPIFFS is 0x4026B000.
This value I also got by modifying FS library (added function to get start address which is used by SPIFFS library).
I'm trying to burn prebuilt with mkspiffs FS image into my ESP by this command:
esptool -cp COM3 -ca 0x4026B000 -cf file.bin
Command complets successfully.
I created a small sketch to test SPIFFS:
#include <FS.h>
void setup() {
Serial.begin(115200);
delay(100);
if (!SPIFFS.begin())
{
Serial.println("Failed to mount file system");
return;
}
}
void loop() {
Dir dir = SPIFFS.openDir("/");
while (dir.next()) {
Serial.print(dir.fileName());
Serial.print("\t");
File f = dir.openFile("r");
Serial.println(f.size());
}
uint32_t addr = SPIFFS.getStartAddress();
Serial.print("0x");
Serial.println(addr, HEX);
delay(10000);
}
It prints:
35586048
117112832
0x4026B000
Filename is empty and a strange filesize...
Real structure of FS image:
mkspiffs.exe -l file.bin
543 /index.html
1787 /loading.gif
Could you please clarify, where I'm wrong? Thank you!