Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By joostn
#5508 In the linker script section .rodata is mapped into RAM:

Code: Select all.rodata : ALIGN(4)
  {
    _rodata_start = ABSOLUTE(.);
    *(.rodata.*)
    *(.rodata)
    *(.gnu.linkonce.r.*)
...
  } >dram0_0_seg :dram0_0_phdr


This is eating a precious 6k of RAM. In all my ARM linker scripts .rodata goes into .text and thus in Flash. Does anyone know why this is, and can it be changed? I've tried to move it but of course it then fails to boot.

And my second question:
Code: Select all  iram1_0_seg :                          org = 0x40100000, len = 0x8000
  irom0_0_seg :                          org = 0x40240000, len = 0x32000

The linker script only uses 232k of the flash. I think it has 512k, is it possible to use the remaining space for code? I don't use the cloud update feature.
User avatar
By Harold L.
#5680
joostn wrote:And my second question:
Code: Select all  iram1_0_seg :                          org = 0x40100000, len = 0x8000
  irom0_0_seg :                          org = 0x40240000, len = 0x32000

The linker script only uses 232k of the flash. I think it has 512k, is it possible to use the remaining space for code? I don't use the cloud update feature.


You can change "org" to a lower address, and increase its len to get more space.
e.g.
irom0_0_seg : org = 0x40210000, len = 0x60000

After compiling, you should burn your .irom0.bin to 0x10000 instead of the original 0x40000. That's because 8266 mapped flash chip start from 0x40200000.

That's what I have done successfully in developing NodeLua project: http://nodelua.org

I have no idea with your first question, but very interested about it, dose anyone know ways to do that?
User avatar
By jcmvbkbc
#5683
joostn wrote:In the linker script section .rodata is mapped into RAM:

Code: Select all.rodata : ALIGN(4)
  {
    _rodata_start = ABSOLUTE(.);
    *(.rodata.*)
    *(.rodata)
    *(.gnu.linkonce.r.*)
...
  } >dram0_0_seg :dram0_0_phdr


This is eating a precious 6k of RAM. In all my ARM linker scripts .rodata goes into .text and thus in Flash. Does anyone know why this is, and can it be changed? I've tried to move it but of course it then fails to boot.

I see at least one reason for that: the bootloader does not enable transparent FLASH mapping in the region 0x40200000, it only loads some code from FLASH and jumps into it. So that code needs to be self-sufficient, at least until the transparent FLASH mapping is enabled.