Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By robertkendrick
#28650 Using fresh copy (git cloned) Sming with freature/rboot I set paths etc and built Basic_rBoot sample. Resulted in the 3 files, rboot.bin, rom0.bin and spiffs_rom.bin.
Flashed these to an esp12 (using Windows).
OTA seems to work ok but the resulting rom1 is bad (see code window).

Code: Select all>info
SDK: vÛ
Free Heap: 43368
CPU Frequency: 80 MHz
System Chip ID: 0x0xa2caf8
SPI Flash ID: 0x0x1640c8
bootconf.roms[slot] = 0x202000
(bootconf.roms[slot] & 0xFFF00000) + 0x100000 = 0x300000



>switch
Swapping from rom 0 to rom 1.
Restarting...

state: 5 -> 0 (0)
rm 0
pm close 7 0 0/189474967
del if0
usl
sul 0 0

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 1544, room 16
tail 8
chksum 0x99
load 0x3ffe8000, len 700, room 0
tail 12
chksum 0xd1
csum 0xd1

rBoot v1.2.1 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash

Rom 1 is bad.
Booting rom 0.
òË뢁use rtc mem data
rl

trying to mount spiffs at 0x40300000, length 65536
fs.start: size:64 Kb, offset:0x0x100000

mount res: 0


Currently running rom 0.
Type 'help' and press enter for instructions.

mode : sta(18:fe:34:a2:ca:f8)
add if0
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 9
pm open phy_2,type:2 0 0
cnt

connected with virginmedia90, channel 7
dhcp client start...
ip:192.168.0.20,mask:255.255.255.0,gw:192.168.0.1

>ls
filecount 1
testfile.txt

>ota
Updating...
+TCP connection
Download file:
    (0) http://192.168.0.17:8080/rom0.bin -> 0x202000
Download: http://192.168.0.17:8080/rom0.bin
connect to: 192.168.0.17
TcpConnection::connect result:, 0
realloc 44 -> 175
OnConnected
TCP connected
onReadyToSendData: 0
TcpClient request completed
TCP sent: 46
onReadyToSendData: 2
TCP received: 17 bytes
onReadyToSendData: 1
TCP received: 37 bytes
onReadyToSendData: 1
Header pos: 145
Content-type === application/octet-stream
Content-Length === 241232
Last-Modified === Tue, 08 Sep 2015 11:35:54 GMT
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
...
...
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 481 bytes
onReadyToSendData: 1
TCP received: (null)
TCP connection closing
-TCP connection
Download file:
    (1) http://192.168.0.17:8080/spiff_rom.bin -> 0x300000
Download: http://192.168.0.17:8080/spiff_rom.bin
+TCP connection
connect to: 192.168.0.17
TcpConnection::connect result:, 0
realloc 49 -> 180
OnConnected
TCP connected
onReadyToSendData: 0
TcpClient request completed
TCP sent: 51
onReadyToSendData: 2
TCP received: 17 bytes
onReadyToSendData: 1
Header pos: 181
Date === Tue, 08 Sep 2015 20:15:11 GMT
Content-type === application/octet-stream
Content-Length === 65536
Last-Modified === Tue, 08 Sep 2015 11:35:56 GMT
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
...
...
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 1460 bytes
onReadyToSendData: 1
TCP received: 21 bytes
onReadyToSendData: 1
TCP received: (null)
TCP connection closing
-TCP connection

Firmware download finished!
 - item: 0, addr: 0x202000, len: 241286 bytes
 - item: 1, addr: 0x300000, len: 65553 bytes
Firmware updated.
In callback...
Firmware updated, rebooting to rom 1...
state: 5 -> 0 (0)
rm 0
pm close 7 0 0/26800350
del if0
usl
sul 0 0

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 1544, room 16
tail 8
chksum 0x99
load 0x3ffe8000, len 700, room 0
tail 12
chksum 0xd1
csum 0xd1

rBoot v1.2.1 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash

Rom 1 is bad.
Booting rom 0.
òË뢁use rtc mem data
rl

trying to mount spiffs at 0x40300000, length 65536
fs.start: size:64 Kb, offset:0x0x100000

mount res: 0


Currently running rom 0.
Type 'help' and press enter for instructions.

mode : sta(18:fe:34:a2:ca:f8)
add if0
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 9
pm open phy_2,type:2 0 0
cnt

connected with virginmedia90, channel 7
dhcp client start...
ip:192.168.0.20,mask:255.255.255.0,gw:192.168.0.1


I not looking for immediate problem solving (we are all busy). I expect others may also be able to shed some light or offer other useful debugging information. What works is certainly impressive.
Of course, if you need further info or testing just let me know.
User avatar
By rab
#28653 For comparison:
Code: Select allload 0x40100000, len 1544, room 16
tail 8
chksum 0x99
load 0x3ffe8000, len 700, room 0
tail 12
chksum 0xd1
csum 0xd1

rBoot v1.2.1 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash

Booting rom 0.
.{Kk"use rtc mem data
{l

trying to mount spiffs at 0x40300000, length 65536
fs.start: size:64 Kb, offset:0x0x100000

mount res: 0


Currently running rom 0.
Type 'help' and press enter for instructions.

mode : null
Updating...
+TCP connection
Download file:
    (0) http://192.168.7.5:80/rom0.bin -> 0x202000
Download: http://192.168.7.5:80/rom0.bin
connect to: 192.168.7.5
TcpConnection::connect result:, 0
realloc 43 -> 174
OnConnected
TCP connected
onReadyToSendData: 0
TcpClient request completed
TCP sent: 45
onReadyToSendData: 2
Header pos: 280
Content-Type === application/octet-stream
Last-Modified === Tue, 08 Sep 2015 21:20:00 GMT
Accept-Ranges === bytes
ETag === "346aea1e7cead01:0"
Server === Microsoft-IIS/7.5
X-Powered-By === ASP.NET
Date === Tue, 08 Sep 2015 21:23:18 GMT
Connection === close
Content-Length === 240752
TCP received: 1436 bytes
onReadyToSendData: 1
...
TCP received: 1224 bytes
onReadyToSendData: 1
TCP received: (null)
TCP connection closing
-TCP connection
Download file:
    (1) http://192.168.7.5:80/spiff_rom.bin -> 0x300000
Download: http://192.168.7.5:80/spiff_rom.bin
+TCP connection
connect to: 192.168.7.5
TcpConnection::connect result:, 0
realloc 48 -> 179
OnConnected
TCP connected
onReadyToSendData: 0
TcpClient request completed
TCP sent: 50
onReadyToSendData: 2
Header pos: 279
Content-Type === application/octet-stream
Last-Modified === Tue, 08 Sep 2015 21:20:00 GMT
Accept-Ranges === bytes
ETag === "68dfea1e7cead01:0"
Server === Microsoft-IIS/7.5
X-Powered-By === ASP.NET
Date === Tue, 08 Sep 2015 21:23:22 GMT
Connection === close
Content-Length === 65536
TCP received: 1436 bytes
onReadyToSendData: 1
...
TCP received: 1199 bytes
onReadyToSendData: 1
TCP received: (null)
TCP connection closing
-TCP connection

Firmware download finished!
 - item: 0, addr: 0x202000, len: 240752 bytes
 - item: 1, addr: 0x300000, len: 65536 bytes
Firmware updated.
In callback...
Firmware updated, rebooting to rom 1...
state: 5 -> 0 (0)
rm 0
pm close 7 0 0/9793765
del if0
usl
sul 0 0

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

load 0x40100000, len 1544, room 16
tail 8
chksum 0x99
load 0x3ffe8000, len 700, room 0
tail 12
chksum 0xd1
csum 0xd1

rBoot v1.2.1 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash

Booting rom 1.
.sKk"use rtc mem data
sd

trying to mount spiffs at 0x40500000, length 65536
fs.start: size:64 Kb, offset:0x0x300000

mount res: 0


Currently running rom 1.
Type 'help' and press enter for instructions.

mode : sta(18:fe:34:a0:52:f6)
add if0
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
pm open phy_2,type:2 0 0
cnt


Looks remarkably similar, except for it not liking your rom1. Noticed one interesting thing though, your content lengths are 241232 & 65536, but the amount flashed is 241286 & 65553. Whereas my content lengths and flashed sizes match (as they should). It looks like your server is sending more data than it should. Perhaps it is using chunked encoding, without declaring it in the header? I suggest dumping the flash from 0x202000 using esptool.py read_flash function and seeing what's in there, I suspect some extra junk has been inserted into the http stream and that's been written to the flash.
User avatar
By robertkendrick
#28658 Hi
Yes, had already dumped the flash at the pertinent boundaries and you are right !
I have an http header/response at 0x202000 followed by what looks like the correct rom0 image.
Code: Select all48 54 54 50 2F 31 2E 30 20 32 30 30 20 4F 4B 0D 0A 53 65 72 76 65 72 3A 20 53 69 6D 70 6C 65 48 54 54 50 2F 30 2E 36 20 50 79 74 68 6F 6E 2F 32 2E 37 2E 37 0D 0A EA 04 00 00 04 00 10 40 00 00 00 00 E0 2D 03 00 00 10 00 00 08 13 10 40 48 DF 00 40 12 C1 D0 C9 A1 CD 02 21 FB FF 3D 01 1C 84 09 B1 01 FA FF C0 00 00 2D 0C 3D 01 1C 84 01 F8


Same for the dump at 0x300000. A header/response followed by what appears to be the correct spiffs image.

My not-so-good-simple-server to blame !