Chat freely about anything...

User avatar
By eriksl
#23795 My firmware is getting a bit larger now. I was under the impression I would have 240 kbyte of space for my program (excluding the part in iram). Linker script says 3c000, which is 240 k. The linker also doesn't complain. Esptool.py also doesn't complain.

BUT as soon as the code reaches 192 k in size (EXACTLY there, very suspicious, 0x30000 exact), the whole code won't run. Something very early in the boot process, because the UART doesn't show anything usable, just a few characters of noise. Nothing happens. Normally my code will spit some text on the UART pretty quick.

Then reduce the code size to < 192k and it runs.

Also very suspicious that it's 256k - 64k, which is two times the amount of iram available. I understand one looses 1 time that amount, but not two times.

This is with the latest SDK (1.2.0) and with opensdk + esptool.py.

On a side note, apparently half of the flash memory is reserved for OTA-updating. I am not going to do that. Anyone knows how to disable the OTA function and use all of the flash memory? Is it something like just changing the section size in the linker script?

Thanks!
User avatar
By eriksl
#24565 Already solved. The default start address is halfway the flash (0x40000), so anything larger than this size will make the addresses wrap around and overwrite 0x00000 -> crash. Relocate the irom region to 0x10000 and all is good. Completely undocumentated. As usual.
User avatar
By dkinzer
#27593
crosofg wrote:How to do that?
Edit the linker script. Assuming you're using eagle.app.v6.ld, look near the beginning of the file and find the line that looks like this:
Code: Select all  irom0_0_seg :                         org = 0x40240000, len = 0x3C000

Change that line like this:
Code: Select all  irom0_0_seg :                         org = 0x40210000, len = 0x6C000

That line is for loading at 0x10000 of a512KB Flash chip. If your ESP8266 has a larger Flash chip (e.g. 2MB) you can make the "len" value larger. If you're using a command line utility to download to Flash, you'll have to specify loading the irom0.text image at 0x10000 rather than at the usual 0x40000 for the non-OTA boot scheme.