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

User avatar
By sharkx
#38608 Thanks. I already turned that PDF inside-out ;)

But there are two problems...

1. the diagram for the 512k moduel shows the non-FOTA layout (as opposed to other memory sizes); the FOTA layout is described in the table; well... this is not a real problem

2. it does not really have an answer to my question about why the irom segment is limited to 176Kb; it actually sais the contrary, which is the irom should be larger ;)

I guess I'll just have to try and see what happens; I just hope I won't brick any module in the process
User avatar
By sharkx
#38930 Followup.
This document has a bit more info in teh Flash Map section : http://bbs.espressif.com/download/file.php?id=1028

One can see that the irom0 is marked as max 176 Kb and the flash.bin is marked as max 64 Kb. But it seems that the real restriction here is that BOTH do not exceed 236 Kb (as also deduced from the OTA document).

So... time to experiment :twisted:
User avatar
By sharkx
#39138 To sum it up, in case someone else needs this info; this applies to the 4MBit flash modules (512 Kb), but I guess others will behave in the same manner; however, one should not reach the flash size limit as easily as with the 512 Kb module.

1. According to the "Flash Map" section in the document 2A-ESP8266__IOT_SDK_User_Manual__EN_v1.5.pdf, for a 512 Kb module, the max size for a userX.bin file is 236 Kb

2. the userX.bin files are built from flash.bin and irom0text.bin

3. irom0text.bin is limited to 172 Kb according to the eagle.app.v6.new.512.appX.ld files

4. flash.bin is expected to be max 64 Kb, but in my case it was about 32 Kb

5. this leads to a userX.bin of a maximum 204 Kb, which wastes about 32 Kb of valuable memory space

6. didn't dig too deep into the compiling and linking procedure, but it looks to me that flash.bin and irom0text.bin are both combined into an assembler text file that is then processed to get get the userX.bin file. One can conclude that as long as the "concatenation" of flash.bin and irom0text.bin stays below the 236 Kb limit, the module will behave correctly.

So ...

Once my irom0text.bin file passed the 172 Kb limit, I tried to extend it to 192 Kb by modifying the eagle.app.v6.new.512.appX.ld files (there's a "len = 0x2B0000" parameter at the beginning of the file that I changed to "len = 0x30000")

The compiler didn't complain, and the userX.bin files went past the 204 Kb limit (see [5] above).

Sucessfully flashed those to the module using both the ESP Flash Download Tool and my own custom OTA updater. The module works as expected so far.

Conclusion : One can safely increase the irom0text.bin size as long as the userX.bin stays below the 236 Kb limit (which was also stated in this post)