Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By piperpilot
#24718 Still banging my head against the wall on this one. I thought I had all of the offset stuff figured out...and I might. But I'm having problems reading from the flash, especially when placed above 0x40300000. Am I hitting some kind of limitation? Here is some debug output:

Code: Select allfirst free block address:40302000
cfg.phys_addr:40304000
fs.start: size:4194272 Kb, offset:0x104000
ERROR: ERROR in flash_read: r=1 at 40304000
ERROR: ERROR in flash_read: r=1 at 40304000


I flashed my spiff_rom.bin to 0x104000 so it should be at the right location.

What am I missing here?
User avatar
By rab
#24724 Does it read SPIFFS using memory mapped flash or spi flash read calls? From the debug it seems to be trying to read from 40304000, which suggests memory mapped flash. This won't work - the esp8266 can only map 1mb of flash at a time (40200000-402fffff). You need your filesystem to be within the same 1mb as the rom. For your current setup you would need to put both roms and both filesystems in the same 1mb (and set the fs offsets accordingly).

Space could be a bit tight though, depending on rom and fs size. The easiest option would probably be to use big flash support. You can then use different 1mb chunks (of which you have 4) of the flash with one rom and one fs on each, just as though you weren't dual booting at all. rBoot then chooses which one to boot for you at startup. The advantage of this (aside from giving you more space for each rom) is you only need to produce one image (same one can be ota flashed to each 1mb chunk of flash) and the layout of each looks just like the traditional single flash version, so no need to play around with changing the default offset at all.
User avatar
By piperpilot
#24882 Thanks Richard...I'm working on integrating the big_flash support now. Having a hard time getting the overridden cache_read_enable_new to get picked up. including it in the LD_FLAGS doesn't seem to be working.

Can you clarify this statement:

Code: Select allAnother way that seems easier was to #include
rboot-bigflash.c into the main .c file, rather than compiling it to a separate
object file.


Which main.c? In my project file? In the Sming world that would be "application.cpp".

Thanks
User avatar
By rab
#24883 I guess that'd be the right place. Hard to say, I have no idea why including it like that that works better than compiling it as a normal object file, I suspect a bug/quirk of gcc. Do put some debug output in there to ensure it's getting called, as suggested.