-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remote firmware update? #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It should already be possible, but you would need to do it by calling the underlying functions directly. The IoT SDK has a series of It would great to eventually expose this through the ESP object with a more user-friendly API. |
Holy crud. That looks fucking awesome!! Thank you! |
We now have parts of OTA update infrastructure ready. Uploads of sketch from the IDE over WiFi are not ready yet, but here is an example sketch which can be updated using a python script: sketch: https://gist.github.com/igrr/43d5c52328e955bb6b09 python script: https://gist.github.com/igrr/d35ab8446922179dc58c EDIT: you need to use either the staging release or build from git to use that feature: http://arduino.esp8266.com/staging/package_esp8266com_index.json |
I'm interested on that, the bin I have to upload is the one finished by cpp_10000.bin? |
I can't upload: EDIT: Works on linux (Ubuntu) |
I think this print statement stuff will not work with python 3. I've written this script with 2.7. |
OK thanks, on Ubuntu iḿ using 2.7.9, I'll see on Windows |
Regarding the bin file, there is now only one .bin file generated (like |
I cannot update: socket.error: [Errno 10054] Se ha forzado la interrupci¾n de una conexi¾n existente por el host remoto I have searched in Google but it seems that the connection is closed by the ESP and i have also tried with HERCULES for windows to see if it sended it and the python programm sended it correctly |
You have the OTATest.ino sketch loaded? On Tue, Jun 16, 2015, 17:42 Pablotis [email protected] wrote:
|
Yes, it shows Update failed when the cmd shows the error |
Can you please post complete output from both sides? |
This is way cool! I have ESP's that are built into walls behind switches On 17 June 2015 at 03:18, Ivan Grokhotkov [email protected] wrote:
|
this seems to work here :) |
Here is the log and the bin file: |
Any new? |
From your log:
It fails because free space size is less than the size of the sketch you are trying to upload. |
But I tried to do it with Blink example and still not working, and doesn't it rewrite de current program? |
In that case please attach the log for the case when you are downloading the blink example. It's pretty hard trying to guess what's happening on your side :) |
I'm pretty sure that even using a blank sketch won't work with 512KB space, On Thu, Jun 18, 2015, 10:05 AM Ivan Grokhotkov [email protected]
|
I was having, what seems to be, the same issue and I suspect it has something to do with my ESP module or flakey wifi signal. this is the output in my terminal:
this is the output on the ESP:
when it works I get following output in terminal:
and this from the ESP:
the Fatal exception seems scary but seems to indicated the update succeeded.. This is a really nice feature! |
Wow this could be a great feature that I will need to try. Does this utilize http://www.esp8266.com/viewtopic.php?f=12&t=3115&start=10 ? |
@CptanPanic i wrote my own bootloader, called eboot. It's a bit more efficient because it requires only one segment for code and data, plus it avoids an extra copying step which both rboot and Espressif's original bootloader choose to do for some reason. Also the code is slimmer and a bit easier to digest. You can check the source code in hardware/esp8266com/esp8266/bootloaders/eboot. |
@igrr I saw it in the git repo but how do you make use of it? Was there an example or samples in the wiki? I saw another post you had about using the ota_server.py. Do you flash the eboot bootloader then use the ota_server.py ipaddress any_arduino_sketch method ? |
The binary which is generated by IDE contains the bootloader in the first In a short while this will be integrated into the IDE so you will just have On Sun, Jun 21, 2015, 03:41 prussiap [email protected] wrote:
|
This is a wonderful project - and it just keeps getting better and better... Thank you everyone who is involved.................. On 21 June 2015 at 09:01, Ivan Grokhotkov [email protected] wrote:
|
Using Arduino IDE 1.6.4 with ESP8266 1.6.4-835.g77d77e8 I get on the ESP-01:
And on the Mac:
|
Free size: 188416 You need to have at least 1M flash for the OTA to fit. On Sun, Jun 21, 2015, 13:22 probonopd [email protected] wrote:
|
This means I need a different hardware module, correct? So OTA will not work on ESP-01? (If so it would be good to document that fact or put in a check). Also, what is not clear to me: When I upload OTAtest, does that mean I can upload blink.cpp.bin OTA and it will still be possible to load another sketch via OTA afterwards, or does every sketch that I upload via OTA need to contain the OTAtest functionality (in order to allow for subsequent OTA updates)? |
This is a very much work-in-progress feature so please forgive the lack of One more thing that you will certainly need in a sketch in order for OTA to On Sun, Jun 21, 2015, 13:38 probonopd [email protected] wrote:
|
@igrr you said earlier about TLS:
Would you have any hints for me about how I would configure Apache2 to do this? Google is coming up dry for me. |
See second comment to the answer: http://stackoverflow.com/a/29850611 On Fri, Nov 6, 2015, 01:45 whyameye [email protected] wrote:
|
i start to document the different OTA processes here: |
Hi! I have tried the OTATest.ino / OTAserver.py sketches from @igrr. See>
This is what I got from the ESP Side>
ets Jan 8 2013,rst cause:1, boot mode:(1,7) ets Jan 8 2013,rst cause:4, boot mode:(1,7)
And this is what I got from the
@Links2004 @igrr thanks!! |
Following up on the earlier conversation to get ESPhttpUpdate working with TLS, I have a server now restricting its TLS fragment (record) size to 4K. (notes about how I did it at https://sites.google.com/site/linuxwebcomputer/lamp-etc). I hacked up the ESP8266httpUpdate.cpp code for TLS connection. The GET request seems to work well and the server happily sends the update. However ESP.updateSketch(tcp, len, false, false) is returning false. Is this method documented somewhere? I couldn't find the code for it. Update: I did find the code to updateSketch in /cores/esp8266/ I also was able to get the updates to work with TLS about 50% of the time by shutting off compression on the webserver and lowering the max record size to 128. From the other 50% of the time, about 45% of the time it timed out in writeStream on the call to readBytes in updater.cpp. A few times it thought it succeeded but the update was corrupt. I think we need a checksum calculated on the update. With compression on the webserver on, updates still succeeded but less often. Higher and lower values for the max record size also sometimes worked but less often. 4095 (4K-1) never worked. If the update fails, subsequent calls to ESP8266httpUpdate immediately fail until the 8266 is rebooted. Is there a way to avoid this? Also, why does ESP8266httpUpdate crash the uC when in loop() but not in setup()? Given that the read() function is in Udp.h, is this really udp and not tcp? That seems like that could be a problem for reliability. And, is there a Udp.cpp or is Udp.h a header for a binary blob? I've been working with the understanding that TLS fragment size is the same as TLS record size and is not related to packet size. |
@tlerdrden you linked files are out to date, try to use this: https://github.com/esp8266/Arduino/blob/master/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino with Arduino IDE 1.6.5. @whyameye the http update is running in TCP no UDP is involved here. may we then see better where the problem is coming from. for debugging the tcp and ssl/tls layer the define is here: Line 5 in 342c4ae
for malloc debug inside the tls set the define DEBUG_TLS_MEM
the ESP8266httpUpdate is working in the setup and the loop at least the non TLS variant. Serial.setDebugOutput(true); shut also help to get the exact hex address where the ESP is rebooting, if its not the
|
Most useful would be to enable DEBUG_SSL in WiFiClientSecure: On Sat, Nov 7, 2015, 12:18 Markus [email protected] wrote:
|
With the debug settings igrr recommended, I see this message repeatedly with any TLS fragment sizes above 1023: Setting the fragment size at 1023 the overflow message goes away. Instead I get |
There is bug in WiFiClientSecure, I'll think about possible fix for this. In the meantime, I think your security requirement may be implemented On Sat, Nov 7, 2015, 19:52 whyameye [email protected] wrote:
|
@igrr so your feeling is that keeping the fragment size to 1023 (which eliminated the overflow errors) is not a good workaround for the bug in WiFiClientSecure? That's the easiest solution for me if you feel it is robust. |
Sorry I didn't get it from your previous post that it finally worked when If it works and you're satisfied with this solution, that's awesome. On Sat, Nov 7, 2015, 23:42 whyameye [email protected] wrote:
|
Will OTA work with current stable version: Stable version 1.6.5-947-g39819f0 ? |
@igrr with fragment size < 1024 I'm finding in one environment it works 100%. In another environment it fails about 1/2 the time. Both environments have very good wifi and internet connectivity. When the update fails I don't see an error. Here's the end of the debug I see:
(The TIMEOUT is my own added debug which is printed when timedRead times out.) I'm not sure how to interpret any of this. -John |
With stable version you might get some issues with OTA. On Sat, Nov 7, 2015, 23:58 whyameye [email protected] wrote:
|
@whyameye |
@igrr I'm not sure the difference in the environments. The one that always works is when the 8266 tethers to my Verizon phone. The one that only sometimes works is when the 8266 tethers to my router, which is connected to the cable company's modem. I'll keep experimenting. |
This resembles issues I had when trying to do OTA over MQTT. Would work fine sometimes, and be quite unreliable at others, never could narrow down the conditions that affected it one way or the other. Someone pointed out that the esp doesn't do fragmented packets very well and suggested trying to reduce MTU, but thats not always practical obviously. Would be nice if we could just fix the fragged packet re-assembly issue. By the way thanks for the fix for MQTT over SSL, its working great! |
@mtnbrit IP fragment re-assembly is not related to this issue. TLS fragment size is a different entity and it's just too large by default (16k). The only way to fit TLS in ESP8266 RAM is to reduce TLS fragment size. |
understood, I'm referring to underlying tcp fragmentation |
I am working on esp8266 module.I am implementing FOTA update operation using HTTP PUSH operation in Arduino IDE. But i am getting follwing error:- So anyone please guide me to solve this kind of problem.. Thanks |
i am not sure what you mean by "HTTP PUSH operation in Arduino IDE" the error shows that your server refused the connection. |
@Links2004 yup Arduino IDE is only used for compiling our code. My .bin file is located in following link So using my esp8266 module i am trying to download this .bin file from HTTP server.But i am encountering with problem: I have also checked my network settings and it is perfectly alright... |
I have seen this error when the chip does not have a valid wifi connection. Try pinging something to make sure wifi works:
|
@d3alek I have checked wifi connection.It is properly connecting to www.google.com. |
Now i have uploaded my .bin file on different server.Following is the link Please anyone guide me to resolve this issue |
your flash settings from the IDE not match your real hardware |
Getting Socket.error 10054: An existing connection was forcibly closed by the remote port ESP Side: connected with test_pod, channel 11 PC Logs: |
Could someone please explain exactly how the Updater knows that the .bin I am trying to upload is for a certain flash size? I am using a esp07 and it fails because the Updater says the flash size is only 1MB and the .bin file is compiled for 4MB. The file itself is only 300kb and I already specified "build_flags = -Wl,-Teagle.flash.1m0.ld" in PlatformIO. Not sure why the resulting .bin-file is regarded as 4MB still. What am I missing? I have even tried to specify the board as "d1_mini_lite" as that one has 1MB flash. Updater still gives me the same error: |
BasicOTA working in ESP-01s (1MB Flash) |
Is it possible to upgrade the codebase so we can remotely upload new firmware?
The text was updated successfully, but these errors were encountered: