Here is old topic: http://www.esp8266.com/viewtopic.php?f=6&t=860
FW OTA upgrade logic is simple:
1. FW checks what SPI Flash user bank (see memory map with OTA support: https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map) currently used by FW with system_upgrade_userbin_check() which returns current bank UPGRADE_FW_BIN1 or UPGRADE_FW_BIN2
2. FW executes system_upgrade_start(struct upgrade_server_info *server) with a file to download opposite to current bank, i.e. if current bank is UPGRADE_FW_BIN1, then it downloads User2.bin, and vice versa.
3. On FW upgrade download and upgrade complete, it executes a callback where cheks if download was OK and then executes system_upgrade_reboot() to boot new FW.
Expected result:
If old FW was in UPGRADE_FW_BIN1 and downlads User2.bin - it should boot from UPGRADE_FW_BIN2 bank after restart.
Actual result:
FW always boots from UPGRADE_FW_BIN1 SPI Flash bank.
+MSG: fw_upgrade
+OK: FW upgrade started.
+OK: FW upgrade success.
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x40100000, len 612, room 16
tail 4
chksum 0x12
load 0x3ffe8000, len 788, room 4
tail 0
chksum 0x50
load 0x3ffe8314, len 264, room 8
tail 0
chksum 0x4a
csum 0x4a
2nd boot version : 1.1
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size : 4Mbit
jump to run user1
+OK: ESP8266 platform started!
Questions:
1. Has anybody the source code of boot_v1.1.bin file from Espressif SDK ?
2. How boot_v1.1.bin decides which user bank (1 or 2) to boot at startup? any settings in SPI Flash?