iram1_0 overflow (again)
Posted: Sat Mar 26, 2016 2:33 pm
Hello folks!
Excuse me for posting a new topic for this well-known problem, but I couldn’t solve my problem even if I read most of the previous posts about the case.
Here is what I know and what I’ve tried until now:
1. ESP8266 has 32KB of instruction RAM and it couldn’t be increased just by modifying the linker script (I have had some MCUs with 16KB of RAM for example, but actually they did have 32KB, so I was able to modify the memory regions w/o problem).
2. ICACHE_FLASH_ATTR will decrease RAM memory used by functions. (I’ve used it almost everywhere in my code).
3. –Os will optimize for size.
4. -ffunction-sections and -Wl,--gc-sections will decrease the memory usage too (I am using that and it works very well! Thanks to the guy that posted this info!). viewtopic.php?f=9&t=3272&start=16
5. Modifying the linker script some libs could be moved to ROM, but attention should be paid to exclude libraries with interrupt driven functions inside (libpp occupies most of the memory, but it isn’t a good idea to move it. The same applies for libgcc, libmain (and what else?). liblwip and libphy are good to move to ROM. (viewtopic.php?f=9&t=3796&start=4).
Since I’ve tried almost everything from the above mentioned, could you have a look over my compiler flags and linker script (because I think I’m missing something) and of course if you have some other ideas on how to decrease the iram1 consumption, please feel free to give me an advice!
Just to try it out, I’ve added the following line to .irom0.text : ALIGN(4) section
But it doesn’t make any difference. The section is again overflowed by the same size.
Possibly you’ll notice that I’m missing the –Os flag, but it doesn’t give me too much additional memory. I would like to secure another 1-2KB of iram1 because I have to write some additional functions. Currently I’ve added and I’m using successfully the SPI driver, UART driver and nRF24 driver that I’m porting.
Thanks!
Excuse me for posting a new topic for this well-known problem, but I couldn’t solve my problem even if I read most of the previous posts about the case.
Here is what I know and what I’ve tried until now:
1. ESP8266 has 32KB of instruction RAM and it couldn’t be increased just by modifying the linker script (I have had some MCUs with 16KB of RAM for example, but actually they did have 32KB, so I was able to modify the memory regions w/o problem).
2. ICACHE_FLASH_ATTR will decrease RAM memory used by functions. (I’ve used it almost everywhere in my code).
3. –Os will optimize for size.
4. -ffunction-sections and -Wl,--gc-sections will decrease the memory usage too (I am using that and it works very well! Thanks to the guy that posted this info!). viewtopic.php?f=9&t=3272&start=16
5. Modifying the linker script some libs could be moved to ROM, but attention should be paid to exclude libraries with interrupt driven functions inside (libpp occupies most of the memory, but it isn’t a good idea to move it. The same applies for libgcc, libmain (and what else?). liblwip and libphy are good to move to ROM. (viewtopic.php?f=9&t=3796&start=4).
Since I’ve tried almost everything from the above mentioned, could you have a look over my compiler flags and linker script (because I think I’m missing something) and of course if you have some other ideas on how to decrease the iram1 consumption, please feel free to give me an advice!
Code: Select all
CFLAGS = -I. -mlongcalls -ffunction-sections
LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -Wl,--end-group -lgcc –lcirom
LDFLAGS = -DICACHE_FLASH -Tlinker.ld -Wl,--gc-sections -Wl,-Map=output.map -Wl,--cref
Just to try it out, I’ve added the following line to .irom0.text : ALIGN(4) section
Code: Select all
*libgcc.a:(.literal .text .literal*, .text*)
But it doesn’t make any difference. The section is again overflowed by the same size.
Possibly you’ll notice that I’m missing the –Os flag, but it doesn’t give me too much additional memory. I would like to secure another 1-2KB of iram1 because I have to write some additional functions. Currently I’ve added and I’m using successfully the SPI driver, UART driver and nRF24 driver that I’m porting.
Thanks!