-->
Page 1 of 1

Reading the firmware (.bin) of ESP8266

PostPosted: Thu Aug 31, 2017 9:01 am
by diffstorm
Hi All,

I'm currently searching how to read the firmware / sketch / .bin file of ESP8266 programatically.

I'm planning to send the firmware over TCP or WebServer.

On which address is stored the firmware?
How can I read it into RAM (per bytes)

Variants:
    Using a RAM function to read the flash
    Copying the firmware into SPIFFS and serve it as file
    Reading the backup of the firmware

What do you suggest?
I'll be happy if anybody can share a code example with me.

Thanks in advance.

Re: Reading the firmware (.bin) of ESP8266

PostPosted: Tue Sep 05, 2017 9:51 am
by diffstorm
up

Re: Reading the firmware (.bin) of ESP8266

PostPosted: Tue Sep 05, 2017 10:49 am
by Godzil
Depends on what you mean by reading?

The bin file is as far as I know a binary dump of the data that as to be written in the EEPROM, so I would not expect any headers or whatever in them.

You can look in the esptool ( https://github.com/espressif/esptool ) how the bin file is managed, but I fear it is just used as a raw file to write in the EEPROM.

If you want to do OTA update, you will need to add your own header and verifications to make sure that the data you are going to write are valid. This can be through the use of a 2nd stage bootloader which will handle the OTA, and never overwrite itself, so it the OTA fail you still have a way to recover the device without to have to use the serial port.

I don't know if such bootloader exist, you may have to write it, but if it is the first time you do such a thing, that's not a simple project to get something secure enough.