-->
Page 1 of 2

Increase available flash size for sketch

PostPosted: Thu Apr 27, 2017 5:29 am
by Jasper np
Hi

The ESP-12 has 4MB of flash but I can only use 1MB for sketches. (1MB Programming / 1MB or 3MB SPIFFS)

For OTA updates you end up being limited to about 500KB~ sketch sizes due to needing free space to download the new file

How can I allow more space for sketch size? Do I need to make a custom board in arduino or is there more to it?

I wouldn't be asking if I hadn't run into sketch size problems

Thanks!

Re: Increase available flash size for sketch

PostPosted: Thu Apr 27, 2017 6:46 am
by Pablo2048
Hi,
I'm using 4MB/2MB SPIFFS configuration. To obtain this You have to modify boards.txt and add:
Code: Select allgeneric.menu.FlashSize.4M2M=4M (2M SPIFFS)
generic.menu.FlashSize.4M2M.build.flash_size=4M
generic.menu.FlashSize.4M2M.build.flash_ld=eagle.flash.4m2m.ld
generic.menu.FlashSize.4M2M.build.spiffs_start=0x200000
generic.menu.FlashSize.4M2M.build.spiffs_end=0x3FB000
generic.menu.FlashSize.4M2M.build.spiffs_blocksize=8192
generic.menu.FlashSize.4M2M.build.spiffs_pagesize=256
generic.menu.FlashSize.4M2M.upload.maximum_size=1044464

and create new linker script file in tools/sdk/ld named eagle.flash.4m2m.ld with:
Code: Select all/* Flash Split for 4M chips */
/* sketch 1019KB */
/* empty  1024KB */
/* spiffs 2028KB */
/* eeprom 20KB */

MEMORY
{
  dport0_0_seg :                        org = 0x3FF00000, len = 0x10
  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000
  iram1_0_seg :                         org = 0x40100000, len = 0x8000
  irom0_0_seg :                         org = 0x40201010, len = 0xfeff0
}

PROVIDE ( _SPIFFS_start = 0x40400000 );
PROVIDE ( _SPIFFS_end = 0x405FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

INCLUDE "../ld/eagle.app.v6.common.ld"

I'm using only this configuration with my OTA sketches for few months without any problem :-)

Re: Increase available flash size for sketch

PostPosted: Thu Apr 27, 2017 7:51 am
by Jasper np
I have created the extra FLASH config, although after compiling the sketch/firmware the memory usage still reads 515532 bytes (49%) of program storage space. Maximum is 1044464 bytes.

Shouldn't we be using 2038KB to double the size of the sketch storage? Or does OTA not require this and the empty 1024KB is instead used?


/* Flash Split for 4M chips */
/* sketch 1019KB */ <---- 2038KB
/* empty 1024KB */ <---- 0KB ?
/* spiffs 2028KB */
/* eeprom 20KB */

Re: Increase available flash size for sketch

PostPosted: Thu Apr 27, 2017 10:10 am
by Jasper np
Question

If I change the following...
nodemcuv2.menu.FlashSize.4M2M.upload.maximum_size=1044464

to...
nodemcuv2.menu.FlashSize.4M2M.upload.maximum_size=2044464

Arduino IDE then reports Sketch uses 515532 bytes (25%) of program storage space. Maximum is 2044464 bytes.

Is this also required to fit OTA updates > 500KB~ ?