512kb module memory map & LD file question

sharkx
Posts: 29
Joined: Wed Jan 06, 2016 2:59 am

512kb module memory map & LD file question

Postby sharkx » Mon Jan 11, 2016 3:37 pm

Context : trying to build user1/user2 files for updating an 512 Kb module.

The LD file states that the irom0_0_seg size is 0x2B000 which is 172k. The flash.bin file size is just a bit under 32k. This adds up to 204k, which is considerably less than the 236k described in the documentation.

Seems like this is quite a waste of memory space given the 176k space barely leaves any space for your code.

Can anyone share some info about why this is configured like this or how and what impact would have increasing the irom0_0_seg size to get closer to the 236k limit ?

Thanks in advance.

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: 512kb module memory map & LD file question

Postby ESP_Faye » Wed Jan 13, 2016 2:31 pm

Hi,

The ld file is set like that by default. But you can change it if needed.

sharkx
Posts: 29
Joined: Wed Jan 06, 2016 2:59 am

Re: 512kb module memory map & LD file question

Postby sharkx » Wed Jan 13, 2016 4:15 pm

Thanks for the reply.

I was planning to try and see what happens... I just hope I don't brick my modules.
Is the bootloader still capable of performing a flash update via the UART0 ? Or it just does the OTA update ?

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: 512kb module memory map & LD file question

Postby ESP_Faye » Mon Jan 18, 2016 2:46 pm

Hi,

Sorry that I do not really understand your question.

You can download the firmware into Flash through UART0 by ESP Flash Download Tool.

Or you can update the firmware through OTA function (OTA needs boot.bin).

sharkx
Posts: 29
Joined: Wed Jan 06, 2016 2:59 am

Re: 512kb module memory map & LD file question

Postby sharkx » Mon Jan 18, 2016 6:34 pm

I was worried that I could not use the Flash Download Tool to restore a module to a working binary file; but I tested and it's ok.

sharkx
Posts: 29
Joined: Wed Jan 06, 2016 2:59 am

Re: 512kb module memory map & LD file question

Postby sharkx » Mon Jan 18, 2016 6:56 pm

So, 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)

Who is online

Users browsing this forum: No registered users and 18 guests