解决 ESP8266 FOTA boot 引导FLASH MAP 出错

时间:2024-03-18 10:53:58

  esp8266  ota 功能调试
  之前第一次接触8266就用fota布局下载官方例程,没有成功,只好先按nonfota方式开发 。
  现在基本功能已经完成。就继续把ota给啃了。
  第一步编译下载,选择user1下载 ,flash map  ==6, 编译生成ok,如下图

SDK_PATH: /home/esp8266/Share/ESP8266_RTOS_SDK/ESP8266_RTOS_SDK-2.0.0
BIN_PATH: /home/esp8266/Share/ESP8266_BIN/upgrade

bin crc: 302d8ae4
Support boot_v1.4 and +
Generate user1.4096.new.6.bin successully in BIN_PATH
boot.bin------------>0x00000
user1.4096.new.6.bin--->0x01000

 

  下载地址如下,参考99c-esp8266_fota_upgrade_cn.pdf

解决 ESP8266 FOTA boot 引导FLASH MAP 出错 

 
  开机后串口一直不停打印,log :


2nd boot version : 1.7(5d6f877)

SPI Speed : 40MHz

SPI Mode : QIO

SPI Flash Size & Map: 4Mbit(256KB+256KB)

jump to run user1 @ 1000

sec 7D ERR

 
很明显 ,flash map 不对啊,我的flash tool设置 和 编译 都是 按 32mbit (1024+1024)来的,这种怪异的事情,
只好先全部擦除 flash 试试,还是一样,又搞了 esptool.py,再擦也是一样。
肯定不是擦除的问题,而是下载的问题了。
从打印信息看,boot 是怎么 得到map 信息的?当然是从flash的某个地址读的。
那再看看下载文件,除了生成的user1.bin。其他的都是死的,所以猜还是从user1.bin读的。
但是我的编译设置并没问题,下载地址也没错。不应该出问题。
不从下载文件取,是从哪取得呢?或者还有谁改变了下载文件?一推测,flash tool完全可以依靠设置来改写信息,
打开flash tool手册一看,果然在这里


DoNotChgBin(Do not change bin file)
If selected, the tool will not modify anything of the bin files.

For ESP32 CHIPs, we can select this option to use default option set by the
esp-idf build system.
Note that, if "DoNotChgBin" is selected, combined binary will
not change the SPI and flash parameters, otherwise, tool will
modify the SPI and flash parameters accordingly.
 

好了,取消DoNotChgBin勾选,是正常的。


2nd boot version : 1.7(5d6f877)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

OS SDK ver: 2.0.0(e271380) compiled @ Mar 30 2018 18:54:06
phy ver: 1055_1, pp ver: 10.7