Remote code update #1284
Replies: 9 comments
-
Posted at 2016-04-02 by Wilberforce Are you talking about updating firmware or updating the current espruino script? If it is the latter, the telnet module allows you to connect via ip, so if the GSM is up, you should be able to connect the in the web i.e., connect via the ip rather than serial. Sorry, I have only tested on the esp8266 (in which the wifi is always connected). With GSM I guess you'll need to have oninit() that will see that network up. I'm also unsure on how you would know what ip it is on - perhaps you could get it to send that to a website via a http get? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-02 by @gfwilliams I think one of the simplest methods would be to use the extra page of flash as you say and to write a 'bootloader' in JavaScript. Something like:
So the first word is the length, second is a very dodgy hash to try and check that the code is valid (it could/should probably be improved!), and then there's the data. This is done from memory though, so may have some bugs I'm afraid. You could then use the flash library to write the code when you received/validated it over GSM:
Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-07 by jonreid Great - thanks for that, a helpful starting point. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-08-10 by jonreid Am only just getting on to implementing this now ! So if I have say V1 of my code save() into the Pico (along with the above bootloader code in onInit() ?)
Thanks |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-08-10 by @gfwilliams I'd actually avoid ... or I guess you could use the V1 as a fallback if needs be, but I'd try and keep the fallback as simple as possible, and ship it with something that the bootloader can load up on to ensure it works correctly!
Yes, that'd be why you don't include the full V1 code unless you have to :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-08-10 by jonreid My only concern around not having the V1 code in there as a fallback, is that if the V2 download fails and the unit reboots, it is then a non-functional unit until it can successfully download code. For our 24x7 remote logging application - this is not really an acceptable possibility. So either I need a way of removing all the V1 code from RAM before running V2, or could I as part of the download new code process do this ?
There would still be some risks around this, but probably acceptable for our application |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-08-11 by @gfwilliams Ahh ok. Personally I'd say rewriting the main flash would be a bad idea - if there were a problem, you could brick everything. Maybe:
That way, your V1 code isn't taking up any RAM at all until it's called - so you don't even need to unload it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-11-29 by Vasily hi. Any final solution on that ? Can you share please. My current idea that all IoT devices (Espruino) that are connected to local Wifi will automatically update JS script:
It must be safe enough, like ... in case script failing it must return to last script that worked or at least the device AP must be available so sending another script should be still possible. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-03 by user91047 This would be extremely valuable. If anyone already has this implemented I would love to hear. If I get to implement this myself I will share it here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-04-01 by jonreid
I am wanting to update code over GSM. I have seen a few discussions on this but they are a little old. Is there a working example of this for the Pico? I assume the extra flash page could hold the code that it's always run on boot? Any pointers welcomed.
Beta Was this translation helpful? Give feedback.
All reactions