LoginSignup
7
7

More than 5 years have passed since last update.

ESP8266の`error magic!`からの復旧

Posted at

ESP8266のフラッシュデータを破壊してしまい、以下のようなエラーログが出てユーザーアプリが起動しなくなった時の復旧方法。

$ miniterm.py /dev/cu.SLAB_USBtoUART 74880
--- Miniterm on /dev/cu.SLAB_USBtoUART  74880,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user2 @ 81000

error magic!
backup boot failed.

user code done

boot.binやuser1.bin、user2.binをflashに書き込んでも復旧できない場合、blank.bin領域が破壊されている可能性がある。

ESP8266のGetting Started Guideを見ると以下のメモリマップになっている。(4096 KB Flash: Support Cloud Update時のメモリマップ)

bin address
esp_init_data_default.bin 0x3FC000
blank.bin 0x3FE000
boot.bin 0x00000
user1.bin 0x01000
user2.bin 0x81000

これに従い、blank.binの書き込みを行う。

esptool.py --port /dev/tty.SLAB_USBtoUART --baud 74880 write_flash --flash_mode=qio --flash_size=32m 0x3fe000 "bin/blank.bin"

これで復旧できた。

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000

SBooted!!

これでも復旧できないときにはesp_init_data_default.bin領域を再度書き直してやるといいのかもしれない。(未確認)

esptool.py --port /dev/tty.SLAB_USBtoUART --baud 74880 write_flash --flash_mode=qio --flash_size=32m 0x3fc000 "bin/esp_init_data_default.bin"
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7