ESPTool
ESPtool
- ESPTool
- Install dependence if necessary, for lubuntu, first install python-pip, than pip install pyserial
apt-get install python-pip pip install pyserial
- More functions by using -h, for specific command try ie esptool.py write_flash -h.:
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 flash_id Read SPI flash manufacturer and device ID read_flash Read SPI flash content erase_flash Perform Chip Erase on SPI flash
- read flash ID:
./esptool.py --baud 115200 --port /dev/ttyUSB0 flash_id Connecting... Manufacturer: e0 Device: 4016
MISC
- Erase - esptool.py --port COM71 erase_flash
- esptool.py read_mac
- esptool.py flash_id
esptool.py v2.8 Found 1 serial ports Serial port COM71 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Features: WiFi Crystal is 26MHz MAC: 60:01:94:2e:cb:92 Uploading stub... Running stub... Stub running... Manufacturer: c8 Device: 4016 Detected flash size: 4MB Hard resetting via RTS pin...
Flash Example
- esptool.py --port COM71 write_flash 0x0 1.5_4MB_8266.bin
- esptool.py --port COM71 write_flash 0x0 1.5_4MB_8266.bin --flash_mode dout --flash_size 4MB --flash_freq 40m
Flash specify 2MB-C1
- esptool.py --port COM71 write_flash 0x0 combined-bin-esp-12s-16mbit-c1.bin --flash_size 2MB-c1
Specify flash mode
- esptool.py -b 1500000 write_flash 0x0 Yorktel_ESP8266_HTTPS_Test_0_0_11.bin
- esptool.py -b 1500000 write_flash --flash_mode dout 0x0 Yorktel_ESP8266_HTTPS_Test_0_0_11.bin
Dump and mass deploy
- After finish coding, upload your code lua into target board, better be complied
- dump out the flash content out and save as firmware.bin file for batch deploy
- use this firmware.bin for new products
- So first setup the esptool.py working environment
- read out the flash content by command
./esptool.py --baud 115200 --port /dev/ttyUSB0 read_flash 0 4194304 output.bin
- 4194304 mbits = 4MB, read flash time take at least more than 5 minutes
- 2097152 mb = 2MB, 1048576 mbits = 1MB, 524288 = 512 KB, 262144 = 256 KB
- use flash download tool flash normally
- Also can try dump mem out, like RAM, etc, dumping the ROM (64 KiB) from the chip:
./esptool.py dump_mem 0x40000000 65536 iram0.bin
Use ESPTOOL.EXE
Find tool at a similar folder: C:\Users\Administrator\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\3.1.0\
esptool.exe --baud 115200 --port COM60 read_flash 0 4194304 output.bin
Read Flash ID: esptool.exe flash_id