Chat freely about anything...

User avatar
By LBussy
#83265 Greetings all.

To set up this question: My first experience using SPIFFS was with ESP32. There I learned to create a partition file (partition.bin) as well as generate a bin file for the SPIFFS data (spiffsgen.py.)

With the ESP8266 I have learned how to use SPIFFS internal to the program such as reading and writing configurations. I have learned to upload the data/ directory via the Arduino IDE as well as with PlatformIO. What I am trying to do however is emulate that functionality I learned with the ESP32 and "package" the data/ directory such that I can release the bin files to end-users.

Is this possible? If so, can someone please point me to an idiot's guide? Google-fu is failing me.

If this is not possible; hopefully, someone has come up with a more glamorous idea than my best one so far (curl-ing in the files on initial setup.)

Thanks in advance for your assistance.
User avatar
By LBussy
#83266 Since posting and waiting for approval I *think* I may have found a glimmer of information. I noticed that PlatformIO makes a "spiffs.bin" when I tell it to upload filesystem. Assuming that's intended to be portable, how does one determine the address? I can see it's 30000 on my D1 but I've not been able to find any references for "partitioning" on the 8266.
User avatar
By LBussy
#83280 Further clarifying my question (I hope):

I have seen the charts related to memory allocation by FLASH size. i.e. my 4mb D1 Mini can have a 1MB or 3MB file system size. With the ESP32 one creates a CSV, passes it through gen_esp32part.py and a *.bin file is created which is then flashed to 0x8000 to create the partitions.

What is the ESP8266 version of this?

I understand one can select the flash size (i.e. 4M (1M SPIFFS)) in the Arduino IDE. How does one distribute a set of BIN files which allow the end-user to flash the files successfully? Is it magic? Does flashing a SPIFFS image to 0x300000 automagically configure the ESP8266 to use the 4M/1M SPIFFS scheme?
User avatar
By quackmore
#83289
Code: Select allDoes flashing a SPIFFS image to 0x300000 automagically configure the ESP8266 to use the 4M/1M SPIFFS scheme?


don't thinks so ...
not having IDF you will have to make sure that the image is coherent with the spiffs config (into code)

I'm using SPIFFS with nonos_sdk and this is my partition table config:

Code: Select all// esp8266 partition table
#if ((SPI_FLASH_SIZE_MAP == 0) || (SPI_FLASH_SIZE_MAP == 1))
#error "The flash map is not supported"
#elif (SPI_FLASH_SIZE_MAP == 2)
...
#define SYSTEM_PARTITION_RF_CAL_ADDR 0xfb000
...
#elif (SPI_FLASH_SIZE_MAP == 3)
...
#define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000
...
#elif (SPI_FLASH_SIZE_MAP == 4)
...
#define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000
...
#elif (SPI_FLASH_SIZE_MAP == 5)
...
#define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000
...
#elif (SPI_FLASH_SIZE_MAP == 6)
...
#define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000
...
#else
#error "The flash map is not supported"
#endif

// esp8266 data partition
#if ((SPI_FLASH_SIZE_MAP == 0) || (SPI_FLASH_SIZE_MAP == 1))
#error "There is no room for spiffs"
#elif (SPI_FLASH_SIZE_MAP == 2)
#error "There is no room for spiffs"
#elif (SPI_FLASH_SIZE_MAP == 3)
#define SYSTEM_PARTITION_DATA 0x101000
#elif (SPI_FLASH_SIZE_MAP == 4)
#define SYSTEM_PARTITION_DATA 0x101000
#elif (SPI_FLASH_SIZE_MAP == 5)
#error "There is no room for spiffs"
#elif (SPI_FLASH_SIZE_MAP == 6)
#define SYSTEM_PARTITION_DATA 0x201000
#else
#error "The flash map is not supported"
#endif

// SPIFFS partition
#define FS_START SYSTEM_PARTITION_DATA
#define FS_END SYSTEM_PARTITION_RF_CAL_ADDR

// SPIFFS config
{
    spiffs_config.phys_size = FS_END - FS_START;
    spiffs_config.phys_addr = FS_START;         
}


so the 3M spiffs partition start at 0x101000
while the 1M spiffs partition start at 0x201000

I'm assuming that Arduino and PlatformIO are using the same offsets (or very close) but you'll need to make sure looking for the spiffs_config into their code

I'm not used with spiffsgen.py and I don't know if you need to specify the initial image offset
but according to IDF documentation you can also use mkspiffs to create the image

using mkspiffs you'll need to specify the starting offset of the image

hope this will help you