Chat freely about anything...

User avatar
By MadMax-ESP
#33924 Maybe it's outdated meanwhile but I just started to work around with ESP8266 some days ago and reached the same question:

how to backup before flash a different firmware...

So I searched and only found "flashing firmware" stuff...

Then I played a little with esptool and I finally was successful with this little script (I just did a "reverse flash"):

#!/bin/bash
# sizes (from file system of files from [some] downloaded firmware) and addresses (from [some] flash readme):
# 28080 Sep 18 21:34 eagle.flash.bin
# 241896 Sep 18 21:34 eagle.irom0text.bin
# 4096 Aug 7 19:56 blank.bin
# 128 Sep 18 20:18 esp_init_data_default.bin

# eagle.flash.bin 0x00000
# eagle.irom0text.bin 0x40000
# blank.bin 0x7e000 & 0xfe000
# esp_init_data_default.bin 0xfc000

echo starting backup part 1 of 5...
esptool --port /dev/ttyUSB0 --baud 115200 read_flash 0x00000 28080 eagle.flash_backup.bin
echo backup of part 1 of 5 finished
read -p "please reset board again into flash mode...[Enter] when done."

echo starting backup part 2 of 5...
esptool --port /dev/ttyUSB0 --baud 115200 read_flash 0x40000 241896 eagle.irom0text_backup.bin
echo backup of part 2 of 5 finished
read -p "please reset board again into flash mode...[Enter] when done."

# not necessary just to be complete
echo starting backup part 3 of 5...
esptool --port /dev/ttyUSB0 --baud 115200 read_flash 0x7e000 4096 blank_backup.bin
echo backup of part 3 of 5 finished
read -p "please reset board again into flash mode...[Enter] when done."

# not necessary just to be complete
echo starting backup part 4 of 5...
esptool --port /dev/ttyUSB0 --baud 115200 read_flash 0xfe000 4096 blank_backup.bin
echo backup of part 4 of 5 finished
read -p "please reset board again into flash mode...[Enter] when done."

# not necessary just to be complete
echo starting last part of backup...
esptool --port /dev/ttyUSB0 --baud 115200 read_flash 0xfc000 128 esp_init_data_default_backup.bin
echo backup completed!


The not so fine thing about it is that I have to "reset" the board back into "flash mode" after each step.
Maybe esptool is not closing the connection after a read_flash?
And unfortunately esptool does not support (at least I could not find out) a "multiple read" like in write_flash (when flashing the board).

But with that method I was able to transfer FW from one board (V0.5) to another board (was V0.4 before and now also is V0.5 ;-) ).

For information:

before:
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04

after:
AT version:0.50.0.0(Sep 18 2015 20:55:38)
SDK version:1.4.0
compile time:Sep 18 2015 21:32:07

Manufacturer: e0
Device: 4014

Maybe this helps someone...

Chears, Joachim