LoginSignup
1
1

More than 3 years have passed since last update.

Windows10で、TTGO T-Cameraのファクトリファームをバックアップする。

Last updated at Posted at 2020-06-13

動機

TTGO T-Cameraを買った。
もともと入っているファクトリーファームは高機能。
他のプログラムを入れると消えてしまう。
ときどき、元のファームウェアに戻して、参考にしたい。

下準備

Anaconda をインストールし、Anaconda Promptを起動して、
"pip install esptool"と入力し、esptoolをインストールする。
Anaconda Promptで"esptool"と入力すると、ヘルプが見られる。

Anaconda_Prompt
(base) C:\WINDOWS\system32>esptool
esptool.py v2.8
usage: esptool [-h] [--chip {auto,esp8266,esp32}] [--port PORT] [--baud BAUD]
               [--before {default_reset,no_reset,no_reset_no_sync}]
               [--after {hard_reset,soft_reset,no_reset}] [--no-stub]
               [--trace] [--override-vddsdio [{1.8V,1.9V,OFF}]]
               {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash_status,write_flash_status,read_flash,verify_flash,erase_flash,erase_region,version}
               ...

esptool.py v2.8 - ESP8266 ROM Bootloader Utility

positional arguments:
  {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash_status,write_flash_status,read_flash,verify_flash,erase_flash,erase_region,version}
                        Run esptool {command} -h for additional help
    load_ram            Download an image to RAM and execute
    dump_mem            Dump arbitrary memory to disk
    read_mem            Read arbitrary memory location
    write_mem           Read-modify-write to arbitrary memory location
    write_flash         Write a binary blob to flash
    run                 Run application code in flash
    image_info          Dump headers from an application image
    make_image          Create an application image from binary files
    elf2image           Create an application image from ELF file
    read_mac            Read MAC address from OTP ROM
    chip_id             Read Chip ID from OTP ROM
    flash_id            Read SPI flash manufacturer and device ID
    read_flash_status   Read SPI flash status register
    write_flash_status  Write SPI flash status register
    read_flash          Read SPI flash content
    verify_flash        Verify a binary blob against flash
    erase_flash         Perform Chip Erase on SPI flash
    erase_region        Erase a region of the flash
    version             Print esptool version

optional arguments:
  -h, --help            show this help message and exit
  --chip {auto,esp8266,esp32}, -c {auto,esp8266,esp32}
                        Target chip type
  --port PORT, -p PORT  Serial port device
  --baud BAUD, -b BAUD  Serial port baud rate used when flashing/reading
  --before {default_reset,no_reset,no_reset_no_sync}
                        What to do before connecting to the chip
  --after {hard_reset,soft_reset,no_reset}, -a {hard_reset,soft_reset,no_reset}
                        What to do after esptool.py is finished
  --no-stub             Disable launching the flasher stub, only talk to ROM
                        bootloader. Some features will not be available.
  --trace, -t           Enable trace-level output of esptool.py interactions.
  --override-vddsdio [{1.8V,1.9V,OFF}]
                        Override ESP32 VDDSDIO internal voltage regulator (use
                        with care)'

(base) C:\WINDOWS\system32>

バックアップの仕方

Anaconda Promptで、"esptool.exe ~ read_flash ~"を実行する。
WindowsのDevice Managerで、TTGO T-Cameraのポート番号(ここではcom8)を確認して指定する。
(実は、指定しなくても、自動で認識して動作するみたいです。)

Anaconda_Prompt
(base) C:\WINDOWS\system32>esptool.exe -c esp32 -p com8 -b 115200 read_flash 0 0x400000 d:\esp32_firmware.bin
esptool.py v2.8
Serial port com8
Connecting.....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: c8:2b:96:88:21:64
Uploading stub...
Running stub...
Stub running...
4194304 (100 %)
4194304 (100 %)
Read 4194304 bytes at 0x0 in 394.9 seconds (85.0 kbit/s)...
Hard resetting via RTS pin...'
(base) C:\WINDOWS\system32>

バックアップからの戻し方

Anaconda Promptで、"esptool.exe ~ write_flash ~"を実行する。

Anaconda_Prompt
(base) C:\WINDOWS\system32>esptool.exe -c esp32 -p com8 -b 115200 write_flash 0 d:\esp32_firmware.bin
esptool.py v2.8
Serial port com8
Connecting....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: c8:2b:96:88:b8:60
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 4194304 bytes to 493980...
Wrote 4194304 bytes (493980 compressed) at 0x00000000 in 46.7 seconds (effective 718.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...'
(base) C:\WINDOWS\system32>

私のところでは、以上により、ちゃんと元のファクトリーファームに戻りました。
皆さんもお試しあれ。

参考記事

https://tomono.tokyo/2019/05/04/7617/
https://lang-ship.com/blog/work/esp32-esptool-py/

1
1
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
1
1