IoT, ESP8266, how to build esptool in win10 to erase the chip flash


ESP8266, the IoT chip or WIFI capable MCU, need tool to burn flash and erase flash, esptool is one of maintained tool of which is open source and ready to be build.


C -source code, efficient esptool.exe

The Arduino IDE composited with ESP8266 core community, it uses a general no overhead and efficient esptool.exe (0.4.9) & build by uses pure C source code, latest version is 0.4.11, github here,

It is likely the same as AVRDUDE when was the boom of AVR chips 10 years ago, so the best way to do that in consideration speed and executable file size, download the C source code and use mingw to compile the C code. Anyway, there is possible two other issues, the C local build has lost the VERSION info, I do not know why or how to fix it, it is perhaps missing something code package, and there is no attempting of repelled copyright or try to exclude source information, this is the first issue, the second, the esptool.exe file size is a lot more less than downloaded one, almost 50% cut, no idea what & why, but the final piece putted together either imported to Arduino IDE 1.8.2 or command line testing, all ok for my work, erase / flash all ok and done.



uses C-source code and local build, no VERSION displayed ? download link,





Python -source code, considerable oversize of simple tool, but may rich of GUI, esptool.exe

How to build this tools under win10, uses Python as interpreter, the final file size is considerable huge in MB;

download python 2.7.13 for windows,

install python, [advance] [compile script to byte code], select include python to path

open cmd,



and enter, if see this, python installation is done



 pip install esptool 

and enter, if seeing this, esptool is build and done, type

 pip install –upgrade esptool 

later on for future upgrade,


connect esp-01, esp-12 or NodeMCU something to your PC, check the com port number, i.e. mine is com8

type --port com8 --baud 74880 erase_flash 

, will erase esp8266 entire SPI flash, or

type -p com8 -b 74880 erase_flash 

, the same effect, read this for detail of how to uses it, -p com8 read_mac 

or this read MAC, the page above is not correctly to describe this at esptool 2.0



this is going to build a complete executable file esptool.exe for Windows, but do not know how to do that yet,


 pip install pyinstaller 

, it will download and install new program. in case you do not like it, type

 pip uninstall pyinstaller 

this is webpage and described how to uses pyinstaller,

here is my try and success, create my.bat, adjust path of the found, and python path, the single esptool.exe is built about 3MB, done after run my.bat

rmdir /s /q build_tmp
mkdir build_tmp

# use python, pip install pyinstaller first
# find and adjust path for
# 2017-JUN-17, test done, built esptool.exe success
# REF :

C:\Python27\scripts\pyinstaller ^
--onefile ^
--specpath build_tmp ^
--workpath build_tmp\build ^
--distpath build_tmp\dist ^

# Output: build_tmp\dist\esptool.exe

# Typical esptool.exe location used by Arduino-ESP32:
# C:\Users\%USERNAME%\Documents\Arduino\hardware\espressif\esp32\tools\esptool.exe




this is another GUI front end for esptool, however, I am not be able manage to get it works as no idea how to install or to compile this nodemcu-pyflasher,


 pip install wxpython 

, install new software

As the developer is actively update his mater pieces about 2 days ago, so to open an issue of how to do that if uses pip for installation would work, because upon win-bat build under win10, the executable file size just huge enough over 14MB, anyway it has been rendered useless as fatal error of failed on, here is the question,