ESP8266 Firmware Update from FileSystem

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
monolith
Posts: 2
Joined: Thu Feb 22, 2018 7:00 pm

ESP8266 Firmware Update from FileSystem

Post by monolith » Thu Feb 22, 2018 7:23 pm

I wonder if it is possible to update MicroPython firmware from file located on the filesystem.

I tried to implment it from python side but, expectedly, process got broken in the middle. I know there is iRAM, so such code should be written in C, I guess. So it is possible to get blocks on the Flash rewritten during program execution.

I would be glad if someone point me to the best way of updating firmware from the file from the FileSystem?

cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: ESP8266 Firmware Update from FileSystem

Post by cefn » Sat Feb 24, 2018 6:54 pm

I can't help you directly as this is a fairly specialist area and I'm out of my depth, (maybe someone else with lower-level expertise can weigh in?)

However I wonder whether there's another way to achieve what you want. What's the purpose of your attempt to replace firmware from a file on the filesystem? What are you REALLY trying to achieve?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ESP8266 Firmware Update from FileSystem

Post by pythoncoder » Sun Feb 25, 2018 8:54 am

Asking MicroPython to replace its own virtual machine at runtime is not likely to produce a happy outcome ;)
cefn wrote:
Sat Feb 24, 2018 6:54 pm
...What's the purpose of your attempt to replace firmware from a file on the filesystem? What are you REALLY trying to achieve?
Quite. There is already a mechanism for OTA (over the air) updates.
Peter Hinch
Index to my micropython libraries.

monolith
Posts: 2
Joined: Thu Feb 22, 2018 7:00 pm

Re: ESP8266 Firmware Update from FileSystem

Post by monolith » Wed Feb 28, 2018 11:53 pm

Hi,

The goal I want to achive is implementation of updating the device firmware from the downloaded file. No matter how the file got there. It can be downloaded using HTTP, MQTT, TCP or even using external network adapter like SIM800.

Having flow like this: Somehow download the file to the flash -> verify downloaded file (integrity and security) -> "burn" firmware -> reboot.

Current OTA implementation uses UDP connection without any encryption or authentication so it is not secure. But even usage of this FOTA requires device and server being in the same local and very-very-stable network. Sending block-by-block to UDP socket though possibly unreliable connection may get the device "bricked". So if you want to have your device somewhere around the world UDP is not the case.

Next goal is firmware verification, before "burning" it. Not only checking of the integrity by MD5 checksum but have it verified by the server to avoid devices get hacked by uploading "malwared" firmwares.

So, the thing I want to make is some sort of bootloader (like that one used for actual OTA implementation) which will "burn" the downloaded firmware.bin to the start of the flash. I belive it can be done even without using a filesystem, by downloading file to the some region of flash (last 1MB for example).

Post Reply