应该引入哪个lib 知道的大侠说一下? 3.14. 为什什么编译的时候会发⽣生“irom0_0_seg”错误?

Sam Shen
Posts: 15
Joined: Tue Jun 21, 2016 4:16 pm

应该引入哪个lib 知道的大侠说一下? 3.14. 为什什么编译的时候会发⽣生“irom0_0_seg”错误?

Postby Sam Shen » Fri Jul 12, 2019 5:34 pm

前提:
SDK:ESP8266_RTOS_SDK-2.0.0
基于:websocket_demo 进行开发。

现象:
main_init中:加入 wifi_set_event_handler_cb(wifi_handle_event_cb);
编译不通过
错误信息如下:
start...

make -C user clean; make -C websocket clean;


make[1]: 进入目录“/cygdrive/d/005.lottery_esp/websocket_demo/user”
rm -f -r .output/eagle/debug
make[1]: 离开目录“/cygdrive/d/005.lottery_esp/websocket_demo/user”
make[1]: 进入目录“/cygdrive/d/005.lottery_esp/websocket_demo/websocket”
rm -f -r .output/eagle/debug
make[1]: 离开目录“/cygdrive/d/005.lottery_esp/websocket_demo/websocket”
rm -f -r .output/eagle/debug
make[1]: 进入目录“/cygdrive/d/005.lottery_esp/websocket_demo/user”
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -fno-builtin-printf -fno-jump-tables -DICACHE_FLASH -I include -I ./ -I ../include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//extra_include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//driver_lib/include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/espressif -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv4 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv6 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/nopoll -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/spiffs -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/ssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/json -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/openssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/mqtt user_main.c
xtensa-lx106-elf-gcc -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -fno-builtin-printf -fno-jump-tables -DICACHE_FLASH -I include -I ./ -I ../include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//extra_include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//driver_lib/include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/espressif -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv4 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv6 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/nopoll -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/spiffs -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/ssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/json -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/openssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/mqtt -o .output/eagle/debug/obj/user_main.o -c user_main.c
xtensa-lx106-elf-ar ru .output/eagle/debug/lib/libuser.a .output/eagle/debug/obj/user_main.o
xtensa-lx106-elf-ar: creating .output/eagle/debug/lib/libuser.a
make[1]: 离开目录“/cygdrive/d/005.lottery_esp/websocket_demo/user”
make[1]: 进入目录“/cygdrive/d/005.lottery_esp/websocket_demo/websocket”
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -fno-builtin-printf -fno-jump-tables -DICACHE_FLASH -I include -I ./ -I ../include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//extra_include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//driver_lib/include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/espressif -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv4 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv6 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/nopoll -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/spiffs -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/ssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/json -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/openssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/mqtt websocket.c
xtensa-lx106-elf-gcc -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -fno-builtin-printf -fno-jump-tables -DICACHE_FLASH -I include -I ./ -I ../include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//extra_include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//driver_lib/include -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/espressif -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv4 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/lwip/ipv6 -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/nopoll -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/spiffs -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/ssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/json -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/openssl -I /cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//include/mqtt -o .output/eagle/debug/obj/websocket.o -c websocket.c
xtensa-lx106-elf-ar ru .output/eagle/debug/lib/libwebsocket.a .output/eagle/debug/obj/websocket.o
xtensa-lx106-elf-ar: creating .output/eagle/debug/lib/libwebsocket.a
make[1]: 离开目录“/cygdrive/d/005.lottery_esp/websocket_demo/websocket”
xtensa-lx106-elf-gcc -L/cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//lib -Wl,--gc-sections -nostdlib -T/cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lcirom -lgcc -lhal -lcrypto -lfreertos -llwip -lmain -lnet80211 -lnopoll -lphy -lpp -lespconn -lsmartconfig -lmbedtls -lopenssl -lwpa -ldriver user/.output/eagle/debug/lib/libuser.a websocket/.output/eagle/debug/lib/libwebsocket.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: *** [/cygdrive/d/005.lottery_esp/ESP8266_RTOS_SDK-2.0.0//Makefile:404:.output/eagle/debug/image/eagle.app.v6.out] 错误 1

如果将wifi_set_event_handler_cb(wifi_handle_event_cb);这句话去掉,编译可以通过。

问题:
是不是默认引入的库不够啊? 有知道的朋友,请指点。
Last edited by Sam Shen on Wed Jul 17, 2019 5:47 pm, edited 1 time in total.

Sam Shen
Posts: 15
Joined: Tue Jun 21, 2016 4:16 pm

Re: 应该引入哪个lib 知道的大侠说一下?

Postby Sam Shen » Fri Jul 12, 2019 5:48 pm

这个问题可以断定是:
3.14. 为什什么编译的时候会发⽣生“irom0_0_seg”错误?

它表示代码量量太⼤大,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. 在路路径 SDK/ld 下修改⽂文件“eagle.app.v6.new.512.app1.ld”。
irom0_0_seg : org = 0x40201010, len = 0x2B000
根据步骤 1 中编译的“eagle.irom0text.bin”⼤大⼩小,改写上述 len 的值。
示例例:如果“eagle.irom0text.bin”⼤大⼩小为 179 KB,则可修改配置如下:
irom0_0_seg : org = 0x40201010, len = 0x2D000
3. 重新编译 user1.bin 选择 boot_v1.2+。
补充说明:
代码中,
• 函数前未加 ICACHE_FLASH_ATTR 的,编译到 IRAM 中,最⼤大 32 KB;
• 函数前加了了 ICACHE_FLASH_ATTR 的,编译到 IROM 中;
因为 RAM的空间有限,因此做了了这两个部分的区分:
• IRAM 中的代码,会在上电初始就完整加载到 RAM 中;
• IROM 中的代码是⽤用到的时候才从Flash 加载到 cache 中执⾏行行。

然而文档里这段话,没啥用啊? 修改长度后:
MEMORY
{
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 = 0x6C000
}
编译通过了,编译参数:
generate bin: eagle.flash.bin+eagle.irom0text.bin
spi speed: 40 MHz
spi mode: QIO
STEP 5: choose spi size and map
3=2048KB( 512KB+ 512KB)

烧写参数:
eagle.flash.bin 0x0
eagle.irom0text.bin 0x20000
esp_init_data_default.bin 0x1fb000
只选了这三项。

问题是运行不了啊???
ets Jan 8 2013,rst cause:1, boot mode:(3,0)

load 0x40100000, len 30328, room 16
tail 8
chksum 0x9c
load 0x3ffe8000, len 2092, room 0
tail 12
chksum 0xd1
ho 0 tail 12 room 4
load 0x3ffe8830, len 2944, room 12
tail 4
chksum 0xbf
csum 0xbf
OS SDK ver: 2.0.0(e271380) compiled @ Mar 30 2018 18:54:06
rf_cal[0] !=0x05,is 0xFF

ets Jan 8 2013,rst cause:1, boot mode:(3,0)

load 0x40100000, len 3
[2019-07-17 17:43:40.720]# RECV ASCII>
0328, room 16
tail 8
chksum 0x9c
load 0x3ffe8000, len 2092, room 0
tail 12
chksum 0xd1
ho 0 tail 12 room 4
load 0x3ffe8830, len 2944, room 12
tail 4
chksum 0xbf
csum 0xbf
OS SDK ver: 2.0.0(e271380) compiled @ Mar 30 2018 18:54:06
rf_cal[0] !=0x05,is 0xFF

ets Jan 8 2013,rst cause:1, boot mode:(3,0)

Sam Shen
Posts: 15
Joined: Tue Jun 21, 2016 4:16 pm

Re: 应该引入哪个lib 知道的大侠说一下? 3.14. 为什什么编译的时候会发⽣生“irom0_0_seg”错误?

Postby Sam Shen » Thu Jul 18, 2019 10:33 am

这个问题搞定了,多看文档就好了。 2a-esp8266-sdk_getting_started_guide_cn.pdf
Attachments
aaa.png

Who is online

Users browsing this forum: No registered users and 8 guests