I used the nodemcuv2 template to build the project：
platform = espressif8266
board = nodemcuv2
framework = esp8266-rtos-sdk
- After I compile a demo, the compilation information prompts as follows:
The flash size of this module is 4MB, but it does not match the compilation information.
Flash memory size is based on the
irom0_0_seg value from the official linker script shipped with the RTOS package
Continuing the discussion from Esp8266 flash size is error:
In this file，the message is：
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40220000, len = 0x5C000
The length of the code space is 0x5C000。It means that as long as I increase the length, I increase the code space, right?
%userprofile%\.platformio\packages\framework-esp8266-rtos-sdk\ld directory there are a couple other linker files - one of which, the 2048 one, defines two 1M partitions, hitting the hardware limit of the ESP8266.
You could copy that file into your
\src directory, and then set a build_flag in your
platformio.ini to use that linker script instead…
build_flags = -Wl,-T$PROJECT_DIR/src/eagle.app.v6.new.2048.ld … which will then give you more space to play with
igrr: The reason we can not have more than 1Mb of code in flash has to do with a hardware limitation. Flash cache hardware on the ESP8266 only allows to map 1Mb of code into the CPU address space at any given time. You can switch mapping offset, so technically you can have more than 1Mb total, but switching such “banks” on the fly is not easy and efficient