You need to:
- esptool erase_flash (optional, if flash contains non WLED code)
- esptool write_flash 0x0 bootloader.bin (optional, if bootloader is too old or missing after erase_flash)
- esptool write_flash 0x8000 partitions.bin (optional, if partitions are incompatible with WLED)
- esptool write_flash 0x10000 wled.bin
You don’t need to disconnect or reboot ESP after each operation.
You may need to compile bootloader binary and/or partition map yourself.
Please see:
https://docs.espressif.com/projects/esptool/en/latest/esp32/esptool/basic-commands.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/bootloader.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html