ESP8266 upload_flags

Hi all,
thanks in advance for a wonderful IDE for my little site projects.

I’m trying to use additional flags for the upload using esptool.py version 3.0.
I’m having a few issues and would like to change the option in esptool from
–after hard_reset to --after soft_reset.

However using upload_flags in the platformio.ini file is giving me errors.

1 attempt: upload_flags = --verbose
→ error unregognized argument: – verbose

2 attempt: upload_flags = --after soft_reset
→ usage: esptool [-h] [–chip {auto,esp8266,esp32,esp32s2,esp32s3beta2,esp32c3}]
[–port PORT] [–baud BAUD]
[–before {default_reset,no_reset,no_reset_no_sync}]
[–after {hard_reset,soft_reset,no_reset}] [–no-stub]
[–trace] [–override-vddsdio [{1.8V,1.9V,OFF}]]
[–connect-attempts CONNECT_ATTEMPTS]
{load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash_status,write_flash_status,read_flash,verify_flash,erase_flash,erase_region,version,get_security_info}

esptool: error: argument operation: invalid choice: ‘–after soft_reset’ (choose from ‘load_ram’, ‘dump_mem’, ‘read_mem’, ‘write_mem’, ‘write_flash’, ‘run’, ‘image_info’, ‘make_image’, ‘elf2image’, ‘read_mac’, ‘chip_id’, ‘flash_id’, ‘read_flash_status’, ‘write_flash_status’, ‘read_flash’, ‘verify_flash’, ‘erase_flash’, ‘erase_region’, ‘version’, ‘get_security_info’)
*** [upload] Error 2

Seems like the option does not appear at the right location in the command line.
From the command line this works pretty nice for me …

C:\Users\sfreunde.platformio\penv\Scripts\python.exe C:\Users\sfreunde.platformio\packages\tool-esptoolpy\esptool.py --before default_reset --after soft_reset --chip esp8266 --port “COM5” --baud 921600 write_flash 0x0 .pio\build\ESPNowReceiver\firmware.bin

esptool.py v3.0
Serial port COM5
Connecting…
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: c4:5b:be:4a:dd:f7
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600
Changed.
Configuring flash size…
Compressed 506320 bytes to 319385…
Wrote 506320 bytes (319385 compressed) at 0x00000000 in 4.6 seconds (effective 882.5 kbit/s)…
Hash of data verified.

Your advice is highly appreciated in advance.
BR Stefan

To influece this, see

So to get

  • --before no_reset_no_sync --after soft_reset you set upload_resetmethod = wifio
  • --before no_reset --after soft_reset you set upload_resetmethod = ck

See Espressif 8266 — PlatformIO latest documentation

If this is destroying the wanted --before setting, you would need a custom script to modify the settings (env["UPLOADERFLAGS"]).

Thanks a lot … Problem solved :slight_smile: