Esptool is a tool to create firmware files for the ESP8266/ESP32 chips and flash the firmware to the chip over serial port. Esptool runs on Windows, Linux and Mac OS X.
Esptool reads the compiled program in ELF format, extracts code and data sections, and either dumps a section to a file or assembles the firmware file from several segments. Esptool also communicates with the bootloader to upload firmware files to flash. Esptool can automatically put the board into UART bootloader mode using a variety of methods.