这些天想研究一下esp8266,于是从官网下载sdk想试试。这个开发环境搭建了半天也按网上的教程把sdk里的文件都整理好后编译。可编译提示错误,提示如下
19:29:03 **** Incremental Build of configuration Default for project ESP8266_NONOS_SDK **** make all make[1]: Entering directory '/cygdrive/i/BaiduYunDownload/esp8266/esp8266 sdk/ESP8266_NONOS_SDK/app' make[2]: Entering directory '/cygdrive/i/BaiduYunDownload/esp8266/esp8266 sdk/ESP8266_NONOS_SDK/app/user' make[2]: Leaving directory '/cygdrive/i/BaiduYunDownload/esp8266/esp8266 sdk/ESP8266_NONOS_SDK/app/user' xt-xcc -L../lib -nostdlib -T../ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lcrypto -lmain -ljson -lupgrade -lssl -lwps -lsmartconfig -lairkiss user/.output/eagle/debug/lib/libuser.a -lat -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 ../Makefile:363: recipe for target '.output/eagle/debug/image/eagle.app.v6.out' failed make[1]: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1 make[1]: Leaving directory '/cygdrive/i/BaiduYunDownload/esp8266/esp8266 sdk/ESP8266_NONOS_SDK/app' Makefile:308: recipe for target '.subdirs' failed make: *** [.subdirs] Error 2 "make all" terminated with exit code 2. Build might be incomplete.
网上找了半天看到有人说把sdk根目录的Makefile文件 第23行BOOT?=none 改成new, APP?=0 改成1 ,SPI_SIZE_MAP?=0改成6 如下图
改完之后居然真的编译通过。可是发现又不对劲了。这个boot改变了就意味的功能都不一样了。于是又去网上搜了半天总是看明白了有boot的是支持云端升级的没有boot是不支持云端升级的。然后我对比后发现boot所需空间很小就4可k左右,而没有boot功能的bin文件有40k左右。那如果不要boot,就不能改Makefile文件还是BOOT?=none ,APP?=0。可是这样编译又提示错误。
又因为这个问题研究了半天终于让我找到问题的原因了。编译所产生的烧录文件eagle.irom0text.bin大小352kb,而ld文件eagle.app.v6.ld中的irom0_0seg ,len =0x3c000,这才240k。如下图
于是我换算了一下352k十六进制 0x58000如下图,
再预留大一些把ld文件的ld文件eagle.app.v6.ld中的irom0_0seg 改成len=0x59000编译成功如下图。
编译前最后先make clean一下。这个问题花了不少时间因为之前对这个也不了解。如果有遇到相同问题的也希望能帮到初学者少走些弯路。