eerimoq / simba

Simba Embedded Programming Platform.
Other
339 stars 66 forks source link

Uploading SPIFFS to ESP8266 #209

Open bsidhipong opened 4 years ago

bsidhipong commented 4 years ago

I'm using Simba framework with PlatformIO in Visual Studio Code, and from looking at various scripts and how they parse things, I've almost got SPIFFS generation and upload working. But not quite. Uploading SPIFFS image somehow killed my application, haha.

So, the upload script makes use of mkspiffs tool, and it parses the linker script, for example: "simba.flash.4m.ld", and it doesn't find the RE pattern it expects. The script looks for SPIFFS{start|end|block|page} and it's easy to add them. For example, the Espressif SDK defines them like so:

eagle.flash.4m1m.ld: (4MB flash, 1MB SPIFFS) / Flash Split for 4M chips / / sketch @0x40200000 (~1019KB) (1044464B) / / empty @0x402FEFF0 (~2052KB) (2101264B) / / spiffs @0x40500000 (~1004KB) (1028096B) / / eeprom @0x405FB000 (4KB) / / rfcal @0x405FC000 (4KB) / / wifi @0x405FD000 (12KB) /

MEMORY { dport0_0_seg : org = 0x3FF00000, len = 0x10 dram0_0_seg : org = 0x3FFE8000, len = 0x14000 iram1_0_seg : org = 0x40100000, len = 0x8000 irom0_0_seg : org = 0x40201010, len = 0xfeff0 }

PROVIDE ( _SPIFFS_start = 0x40500000 ); PROVIDE ( _SPIFFS_end = 0x405FB000 ); PROVIDE ( _SPIFFS_page = 0x100 ); PROVIDE ( _SPIFFS_block = 0x2000 );

INCLUDE "local.eagle.app.v6.common.ld"

I tried to add the LD symbols above, but that must not mesh with the #defines in Simba somewhere.

Can you point me in the right direction? Having the ability to pre-initialize SPIFFS and upload them on-demand via PlatformIO task would be very convenient.

bsidhipong commented 4 years ago

OK, answering myself ... apparently the problem was that Simba uses SPIFFS block and page size that aren't easily customized outside of the source tree. The hardcoded values are block size = 4096, and page size = 256, so the answer was to modify the Simba linker script as attached. simba.flash.4m.ld.txt