问题:
编译AliOS Things
的helloworld_demo
工程,烧录到ESP8266运行,上电后蓝灯常亮,循环输出以下错误:
Fatal exception (0):
epc1=0x401000b5, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
过程分(zhe)析(teng):
AliOS Things学习笔记(3)——ESP8266编译与烧录
使用的NodeMCU开发板,因为之前在另一个同型号开发板测试程序和烧录方式是没问题的。
所有判断可能是以下问题:
- 1、USB线问题,导致烧录固件不完整。
- 2、烧录工具有问题
- 3、下载速率过高
- 4、供电不足
- 5、模块FLASH有问题
- 6、AliOS Things版本不同导致的错误
但是经过测试以上问题都一一排除了。
后来在另一台电脑上用同样的步骤烧录同样的开发板,没有任何问题,然后就觉得匪夷所思了。
然后头发都快抓完了时候,想到了是否电脑环境区别,再想到编译过程中要用到python,就想是否python版本问题导致的了,果然从python3
切换到python2
后,问题就没有了。
分析了编译时输出的LOG信息,并没有不同,这算是个隐藏问题了。
解决:
参考:Linux下切换python版本(python2和python3版本切换)
python版本切换:
//删除当前默认版本
sudo rm /usr/bin/python
//创建软链接:
//切换到 python2
sudo ln -s /usr/bin/python2 /usr/bin/python
//再次查询默认版本,看是否切换成功
python -V
重新安装编译环境:
因为切换版本后,之前的环境不在python2下,所以需要重新安装。
# 重新安装依赖库和aos-cube
python -m pip install setuptools wheel aos-cube
# 查询版本确认是否安装成功
aos --version
附:编译LOG
aos-cube version: 0.5.11
Check if required tools for esp8266 exist
Parsing all components ...
Build Configuration:
====================
App: helloworld_demo
Board: esp8266
====================
Creating out/config/autoconf.h ...
platform/board/stm32f103rb-nucleo/Config.in:3:warning: defaults for choice values not supported
platform/board/esp8266/Config.in:3:warning: defaults for choice values not supported
platform/board/mk3072/Config.in:3:warning: defaults for choice values not supported
application/example/example_legacy/uai_demo/uai_kws_demo/Config.in:15:warning: defaults for choice values not supported
application/example/example_legacy/uai_demo/uai_cifar10_demo/Config.in:15:warning: defaults for choice values not supported
Making config file for first time
processing components: helloworld_demo esp8266
*** All Components: helloworld_demo esp8266 osal_aos mcu_esp8266 kernel_init network rhino yloop newlib_stub lwip netmgr arch_xtensa_lx106 ulog lib_rbtree vfs kv
Build AOS Now
TOOLCHAIN_PATH=
Compiling helloworld_demo
Compiling board_esp8266
Compiling osal_aos
Compiling mcu_esp8266
platform/mcu/esp8266/hal/misc.c: In function 'hal_reboot':
platform/mcu/esp8266/hal/misc.c:32:5: warning: implicit declaration of function 'rom_i2c_writeReg' [-Wimplicit-function-declaration]
rom_i2c_writeReg(0x67, 4, 1, 8);
^
platform/mcu/esp8266/hal/misc.c: In function 'hal_reboot_bank':
platform/mcu/esp8266/hal/misc.c:44:5: warning: implicit declaration of function 'ota_msleep' [-Wimplicit-function-declaration]
ota_msleep(300);
^
platform/mcu/esp8266/hal/misc.c:48:9: warning: implicit declaration of function 'system_upgrade_process' [-Wimplicit-function-declaration]
system_upgrade_process();
^
platform/mcu/esp8266/hal/misc.c:49:9: warning: implicit declaration of function 'system_restart_in_nmi' [-Wimplicit-function-declaration]
system_restart_in_nmi();
^
platform/mcu/esp8266/hal/uart.c: In function 'hal_uart_send':
platform/mcu/esp8266/hal/uart.c:24:9: warning: implicit declaration of function 'uart0_write_char' [-Wimplicit-function-declaration]
uart0_write_char(pdata[i]);
^
Compiling kernel_init
Compiling rhino
platform/mcu/esp8266/hal/wifi_port.c: In function 'register_wlan_mgnt_monitor_cb':
platform/mcu/esp8266/hal/wifi_port.c:733:9: warning: implicit declaration of function 'wifi_set_sta_rx_probe_req' [-Wimplicit-function-declaration]
wifi_set_sta_rx_probe_req(esp_mgmt_filter);
^
platform/mcu/esp8266/hal/wifi_port.c: At top level:
platform/mcu/esp8266/hal/wifi_port.c:801:5: warning: initialization from incompatible pointer type [enabled by default]
.get_wireless_info = get_wireless_info,
^
platform/mcu/esp8266/hal/wifi_port.c:801:5: warning: (near initialization for 'aos_wifi_esp8266.get_wireless_info') [enabled by default]
Compiling yloop
Compiling newlib_stub
Compiling netmgr
Compiling arch_xtensa_lx106
Compiling ulog
Compiling lib_rbtree
Compiling vfs
Compiling kv
Making out/helloworld_demo@esp8266/ld/eagle.app.v6.new.1024.app1.ld
Making out/helloworld_demo@esp8266/libraries/helloworld_demo.a
Making out/helloworld_demo@esp8266/libraries/board_esp8266.a
Making out/helloworld_demo@esp8266/libraries/osal_aos.a
Making out/helloworld_demo@esp8266/libraries/mcu_esp8266.a
Making out/helloworld_demo@esp8266/libraries/kernel_init.a
Making out/helloworld_demo@esp8266/libraries/rhino.a
Making out/helloworld_demo@esp8266/libraries/yloop.a
Making out/helloworld_demo@esp8266/libraries/newlib_stub.a
Making out/helloworld_demo@esp8266/libraries/netmgr.a
Making out/helloworld_demo@esp8266/libraries/arch_xtensa_lx106.a
Making out/helloworld_demo@esp8266/libraries/ulog.a
Making out/helloworld_demo@esp8266/libraries/lib_rbtree.a
Making out/helloworld_demo@esp8266/libraries/vfs.a
Making out/helloworld_demo@esp8266/libraries/kv.a
Making helloworld_demo@esp8266.elf
Making helloworld_demo@esp8266.bin
Making helloworld_demo@esp8266.hex
AOS MEMORY MAP
|=================================================================|
| MODULE | ROM | RAM |
|=================================================================|
| arch_xtensa_lx106 | 2662 | 2784 |
| board_esp8266 | 1214 | 44 |
| helloworld_demo | 166 | 12 |
| kernel_init | 108 | 0 |
| kv | 2228 | 24 |
| libcirom | 27511 | 1200 |
| libcrypto | 14508 | 0 |
| libgcc | 2167 | 0 |
| libhal | 37 | 0 |
| liblwip | 30717 | 1596 |
| libmain | 30412 | 708 |
| libnet80211 | 42675 | 3213 |
| libphy | 48158 | 461 |
| libpp | 43992 | 18013 |
| libwpa | 17240 | 626 |
| mcu_esp8266 | 4652 | 236 |
| newlib_stub | 363 | 0 |
| osal_aos | 706 | 0 |
| rhino | 11529 | 3288 |
| ulog | 573 | 7 |
| vfs | 1420 | 1113 |
| yloop | 1978 | 32 |
| *fill* | 2010 | 108 |
|=================================================================|
| TOTAL (bytes) | 287026 | 33465 |
|=================================================================|
Generate standard flash images out/helloworld_demo@esp8266/binary/helloworld_demo@esp8266.elf
bin crc: 62e57d3f
Generate Raw OTA image: out/helloworld_demo@esp8266/binary/helloworld_demo@esp8266_ota.bin ...
Generate Compressed OTA image: out/helloworld_demo@esp8266/binary/helloworld_demo@esp8266_ota.bin.xz ...
289220
ffdf368ebd6806544ad0b90d607f2df5
193524
c6cb4ddc7358f0d8e3fe871e66f79736
Build complete: helloworld_demo@esp8266