Self-updating code

Posted on
  • In what is probably a very bad idea, I've decided to have a crack at writing some code for the Espruino which will update itself. i.e, you flash a bootstrapper to the Espruino, and after it runs its first init, it will fetch more javascript code from the internet (even the bootstrapper code), write it to the node_modules folder on the connected SD card, and reboot into the new code.

    Basic tests have gone well, but no doubt I will run into some critical issue at some point.

    As for why, I need to be able to deploy my Espruino WiFis to a location and not require them to come back to me to be updated, so self updating is a must.

  • I'd be interested in seeing your code if you are happy to share..

  • Once its done I'll put it up :)

  • Sounds like a great plan. Perhaps you could use the watchdog timer and have some kind of reboot counter so that the bootloader could recover itself if the device ever got a broken update?

  • Any progress?

  • +1 for a progress update :P

  • Here you go. It needs much more work on checking for errors. Unfortunately I don't think SD errors are catchable so they can't be handled right now.

    https://github.com/solworksltd/espruino-­self-update

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Self-updating code

Posted by Avatar for dave_irvine @dave_irvine

Actions