how to use esptool .py mac code example
Example: esptool esp32
// delete firmware
esptool.py --port COM3 erase_flash
// write firmware
esptool.py --chip esp32 --port COM3 write_flash -z 0x1000 esp32-idf3-20191220-v1.12.bin
// delete firmware
esptool.py --port COM3 erase_flash
// write firmware
esptool.py --chip esp32 --port COM3 write_flash -z 0x1000 esp32-idf3-20191220-v1.12.bin