Chat freely about anything...

User avatar
By rekod
#4889 I flashed my current FW (doesn't support OTA yet, but already uses OTA memory layout) with "make flash" from your Makefile (thanks!!!) and it works well !
At least it works on new memory layout as it worked before :)
Will try to implement OTA using code examples from "AT commands" FW ...
User avatar
By rekod
#5034 Hi, Bananis!

I did check at_ipCmd.c file of "AT firmware" and your default.aspx file from http://www.esp8266.com/viewtopic.php?f=9&t=620
and found that for my simple FW it's NOT necessary to implement full authorization procedure like "AT firmware" does (for legacy?),
but simple execute system_upgrade_start() with struct upgrade_server_info structure filled with correct data.

i.e. in theory FW may fill url, server ip and port and other fields of upgrade_server_info structure and then just run system_upgrade_start() and then check a result in callback function.
Is it correct?

So, I wrote a simple UDP server (nodejs) for issue commands to ESP8266 over WiFi and when command for firmware update received - upgrade procedure runs.
Also I wrote HTTP server (nodejs) that serves a User1.bin and User2.bin files, i.e. "GET /User1.bin HTTP/1.1\r\n" returns me User1.bin contents.

The result is:
1. ESP8266 runs system_upgrade_start() and successfully connected to HTTP server and downloads User2.bin (current FW runs User1.bin)
2. But then in callback server->upgrade_flag is false, that means that upgrade didn't succeed (how to know why? any error code?)

HTTP request and response texts are (captured by Wireshark):
Code: Select allGET /User2.bin HTTP/1.1
Connection: close
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/x-download
Content-Disposition: attachment; filename=User2.bin
Content-Length: : 209964
Date: Thu, 18 Dec 2014 00:22:22 GMT
Connection: close



And also I attached all the source code, including HTTP server for upgrades and UDP server for issuing commands.

Could you please take a look? Maybe I forgot some simple thing (version details, checksum, etc.)?
It seems that I'm one step from fully working code that much simpler that "AT firmware" (my FW source code ~8Kb now), but also supports OTA...
Attachments
OTA test of custom FW.
(12.7 KiB) Downloaded 472 times
User avatar
By rekod
#5111 Did anybody try to use built-in function system_upgrade_start() to get custom FW (i.e. not "AT command based" example) from custom HTTP server ?

My test code (attached in this topic) successfully downloads firmware (I see it in Wireshark), then thinks 2-3 seconds, then indicates that FW upgrade ends with error (no detailed explanation of type of the error given, just upgrade_flag is set to false). After that esp8266 reboots from user app slot1 (on FW upgrade success expected reboot from user app slot2).
User avatar
By rekod
#5119 I found that caused upgrade problem: Content-Length was mistakenly sent with extra ":" sign (see HTTP request/response logs above).

But now I have another problem:
Code: Select all+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!
+INF: WiFi connecting...
+INF: WiFi connecting...
+INF: WiFi connecting...
+INF: WiFi connecting...
 +OK: WiFi connected!
+INF: Starting UDP server...
+INF: UDP server started at 1a:fe:34:9f:12:d3 0.0.0.0:8266

The bootloader always jumps to user1, even if it downloads user2 for FW upgrade.
What I'm doing wrong?