All,
I doubt this is specifically a Fast LED question, but it is a FastLED project, so perhaps someone can shed some light on it for me. I have a project I’m working on, that I’ve now run on several dev boards … started on a pro-mini, went to a mega, moved to a Teensy LC, and now I’m trying to run it on a NodeMCU esp8266 to use the wifi. Anyway, the code works, and if I load the FastLED portion of the code on the esp8266, it works with no issues, when I try to merge it with the code for a simple webserver, I get the message:
… section .text' will not fit in regioniram1_0_seg’
The webserver code works fine by itself, as does the FastLED code, but I can’t seem to fit them both, however, I feel like I should be able to. I’ve found scattered references around the web about the esp8266 not storing functions in flash memory by default (and causing this error) requiring the use of “ICACHE_FLASH_ATTR”, but they all seem to be from 2015, and as far as I can tell may have been fixed since then? Also … I can’t seem to figure out how to use that, if it’s still required.
Anyway, if anyone has worked with these chips and can shed some light on the issue, it’d be greatly appreciated.
what is the data source for your webserver? Big strings, or SPIFFS, or something else? When you compile your webserver code, what is the reported flash and ram usage?
The webserver code is just a basic example that I found on-line somewhere … it just lets you turn the on-board LED on/off … the whole thing really only consists of one page that’s stored in a string (once I had the two living together, I was going to start reworking the webserver to be useful to control the LED strings). In its simple, solo state, it compiles with:
Sketch uses 244769 bytes (23%) of program storage space. Maximum is 1044464 bytes.
Global variables use 35852 bytes (43%) of dynamic memory, leaving 46068 bytes for local variables. Maximum is 81920 bytes.
The LED sketch alone reports:
Sketch uses 233973 bytes (22%) of program storage space. Maximum is 1044464 bytes.
Global variables use 34684 bytes (42%) of dynamic memory, leaving 47236 bytes for local variables. Maximum is 81920 bytes.
I commented it out and replaced it with an empty string, but the result is the same. I think I need to get the functions moved out of iram and in to flash, but when I implement ICACHE_FLASH_ATTR, it doesn’t seem to help (assuming I’m doing it correctly)
So I started commenting out portions of code, and watching the memory usage, and saw something that I found a bit bizarre.
six times in the setup() (incrementing the array indexes). If I comment out the last two calls, the code compiles and reports:
Sketch uses 252425 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 38224 bytes (46%) of dynamic memory, leaving 43696 bytes for local variables. Maximum is 81920 bytes.
But if I only comment one of them (allowing the first 5 to run), I get the .text' will not fit in regioniram1_0_seg’ error. Going from 46% with 4 references, to full with 5 doesn’t seem to add up…?