Make sure you have Pycom's official firmware tool installed.
If you wan to utilize esptool instead you can follow this guide.
$ pycom-fwtool-cli --port /dev/ttyUSB0 erase_all
$ pycom-fwtool-cli -r --port /dev/ttyUSB0 flash --tar ESP32-4MB-1.20.2.rc11.tar.gz
# make sure you adjust the com port
> pycom-fwtool-cli.exe --verbose --port COM4 erase_all
> pycom-fwtool-cli.exe -r --verbose --port COM4 flash --tar ESP32-4MB-1.20.2.rc11.tar.gz
Refer to the Pycom doc's for usage.
Note: for pins, use 'GPIOxx' or 'GPIxx' instead of 'Pxx' as outlined in the docs.