


If it shows compile error like below when we compile our source code by setting as 512KB flash with FOTA(firmware upgrade through WIFI).
Code: Select all
xtensa-lx106-elf-gcc -L../lib -nostdlib -T../ld/eagle.app.v6.new.512.app1.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lmain -ljson -lssl -lupgrade -lsmartconfig user/.output/eagle/debug/lib/libuser.a driver/.output/eagle/debug/lib/libdriver.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out
/opt/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: .output/eagle/debug/image/eagle.app.v6.out section `.irom0.text' will not fit in region `irom0_0_seg'
collect2: error: ld returned 1 exit status
make: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1
It means your source code is too large to fit in.
We can try follow steps on SDK_v0.9.5 (or later) to solve it:
1. compile with default configuration to generate eagle.flash.bin and eagle.irom0text.bin
(1) size of eagle.flash.bin + size of eagle.irom0text.bin >= 236KBytes:
Sorry, your source code is too large, you need to change to a new flash which size is larger than 512KB.
(2) size of eagle.flash.bin + size of eagle.irom0text.bin < 236KBytes:
OK, try step 2.
2. revise file "eagle.app.v6.new.512.app1.ld" which is in \esp_iot_sdk\ld.
Code: Select all
irom0_0_seg : org = 0x40201010, len = 0x2B000
change the value of "len" according to the size of your "eagle.irom0text.bin".
Example: if size of “eagle.irom0text.bin” is 179KB, change the configuration to
Code: Select all
irom0_0_seg : org = 0x40201010, len = 0x2D000
3. compile user1.bin by selecting boot_v1.2+
PS.
In your source code,
methods without "ICACHE_FLASH_ATTR" in iram1_0_seg which can be 32KB at most,
methods with "ICACHE_FLASH_ATTR" in irom0_0_seg.
Due to ram is limited,so we have these two parts:
methods in iram1_0_seg will be loaded to ram and run when power on;
methods in irom0_0_seg will be loaded to cache and run only if it is called;
如果在编译 512KB flash 支持云端升级版本的软件时,遇到如下错误:
Code: Select all
xtensa-lx106-elf-gcc -L../lib -nostdlib -T../ld/eagle.app.v6.new.512.app1.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lmain -ljson -lssl -lupgrade -lsmartconfig user/.output/eagle/debug/lib/libuser.a driver/.output/eagle/debug/lib/libdriver.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out
/opt/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: .output/eagle/debug/image/eagle.app.v6.out section `.irom0.text' will not fit in region `irom0_0_seg'
collect2: error: ld returned 1 exit status
make: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1
它表示代码量太大,irom 区域存放不下了。
我们可以在 SDK_v0.9.5(及之后)的软件版本中,尝试如下步骤,解决这个问题:
1. 使用默认设置,编译生成 eagle.flash.bin 和 eagle.irom0text.bin
(1) 如果 size of eagle.flash.bin + size of eagle.irom0text.bin >= 236KBytes:
-> 很抱歉,您的代码量太大了,只能换大些的 flash,或者放弃云端升级功能了。
(2) 如果 size of eagle.flash.bin + size of eagle.irom0text.bin < 236KBytes :
-> 请继续步骤 2
2. 在路径 \esp_iot_sdk\ld 下修改文件 “eagle.app.v6.new.512.app1.ld”
Code: Select all
irom0_0_seg : org = 0x40201010, len = 0x2B000
根据步骤1中编译的 “eagle.irom0text.bin” size 大小,改写上述 len 的值
示例:如果 “eagle.irom0text.bin” 大小为 179KB,则可修改配置如下
Code: Select all
irom0_0_seg : org = 0x40201010, len = 0x2D000
3. 重新编译 user1.bin 选择 boot_v1.2+
补充说明:
代码中,
函数前未加 ICACHE_FLASH_ATTR 的,编译到 iram 中,最大 32KB;
函数前加了 ICACHE_FLASH_ATTR 的,编译到 irom 中;
因为 ram 的空间有限,因此做了这两个部分的区分:
iram 中的代码,会在上电初始就完整加载到 ram 中;
irom 中的代码是用到的时候才从flash 加载到 cache 中执行;
希望本文对您有所帮助!
Thanks for your interest in ESP8266 !