FOTA ESP8266-RTOS-SDK

Rutharesh
Posts: 6
Joined: Tue Dec 01, 2015 3:09 pm

FOTA ESP8266-RTOS-SDK

Postby Rutharesh » Tue Jun 07, 2016 9:32 pm

I am using the RTOS-SDK for FOTA updates, using the example code that i have attached.

I have placed the user1.bin and user2.bin in the local server. I have used the flash size of
FLASH_SIZE_32M_MAP_1024_1024 Flash size : 32Mbits. Map : 1024KBytes + 1024KBytes

I am currently running the user1.bin and from that i have successfully flashed the user2.bin, before flashing I will call

Code: Select all

system_upgrade_flag_set(UPGRADE_FLAG_START);

After flashing,

Code: Select all

system_upgrade_flag_set(UPGRADE_FLAG_FINISH);
        system_upgrade_reboot();


When I call system_upgrade_reboot(), the device is successfully booted in user2.bin and viceversa from user2.bin to user1.bin

case 1:
Now I am running user1.bin, when there is an issue in booting the newly flashed user2.bin, it fails to boot. Now the the backup bin (user1.bin) gets booted successfully and its log as follows.

[FOTA Update]: Upgrade success, rebooting device...
reboot to use2
del if0
usl
sul 0 0

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0

2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user2 @ 81000

error magic!
first boot failed, reboot to try backup bin


ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0

2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000

The device runs the Backup bin (In this case user1.bin)

case 2:
When user2.bin is running, and if there is an issue in user1.bin file the reboot of user1.bin fails and device tries to boot the backup user2.bin in the address "0x81000". But the device always tries to boot the backup bin in the address location of "0x01000" which points to "user1.bin"(already failed to boot).
In this case the device fails to boot the correct backup bin, so the device moves to a dead state.

In this case, please provide a solution to boot the correct backup bin.
Attachments
rtos_upgrade_demo.zip
(5.08 KiB) Downloaded 339 times

tobewinner
Posts: 45
Joined: Tue Jan 19, 2016 2:39 pm

Re: FOTA ESP8266-RTOS-SDK

Postby tobewinner » Sun Jun 12, 2016 9:52 pm

I think you can try to make 2 bins:
for the user1.bin:
it is the backup bin, that is this bin only do a little essential work including upgrade the user2.bin, and this bin will be upgraded rarely.
for the user2.bin:
it is the real working bin, that is this bin do all the work your device need to do.
when you need to upgrade the real firmware of this device, if it is running in user2.bin, then the device reboot to user1.bin and if it is running at user1.bin, then upgrade user2.bin.
because the user1.bin is rarly upgraded, this device always get a good firmware to run.
of cause, it may not work if you need to upgrade the user1.bin(and failed upgrading user1.bin).

Who is online

Users browsing this forum: No registered users and 13 guests