*** [upload] Error 255 ESP8266 - upload_flags for --auth break USB Serial upload

ESP8266 Arduino code from a commit earlier today that /was/ working now compiles fine but fails before usb serial upload with this 255 Error. Since it was working perhaps I have messed up the installation by installing esptool.py via pip or some other operation?

removing upload_flags = --auth=password1234 fixes the problem. Problem exists with dev release and stable.

I’m not sure what I’ve done wrong.

Try to run with --verbose and check output at the end near esptool.py. Maybe, something is wrong with comamnd.

I had not been testing the code with USB serial upload until now I realise. When I have the upload_flags auth set, USB upload no longer works until the upload_flags are removed from the ini.

Run pio run -v -t upload

with platform.ini :

[env:server_d1]
platform = espressif8266
framework = arduino
board = d1_mini
board_f_cpu = 160000000L
build_flags = -Wl,-Tesp8266.flash.4m1m.ld
upload_speed = 230400
board_f_cpu = 160000000L
upload_port = /dev/cu.wchusbserial1d20
src_filter = +<*> -<client.cpp>
build_flags = ${developer.build_flags}
upload_flags = --auth=password123
lib_deps =
    ArduinoJson
    Time
    ESP8266WiFi
    FastLED

pio run -e server_d1 -v -t upload with upload_flags specified:

Use manually specified: /dev/cu.wchusbserial1d20
esptool -vv -cd nodemcu -cb 230400 -cp "/dev/cu.wchusbserial1d20" --auth=password123 -cf .pioenvs/server_d1/firmware.bin
esptool v0.4.9 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to nodemcu
setting baudrate from 115200 to 230400
setting port from /dev/tty.usbserial to /dev/cu.wchusbserial1d20
*** [upload] Error 255

Looks like it could maybe be as a result of me running sudo pip install esptool or it always happened before and I just didn’t test it with USB Serial upload until after I started specifying the OTA password in upload_flags.

pio run -e server_d1 -v -t upload without upload_flags specified:

MethodWrapper(["upload"], [".pioenvs/server_d1/firmware.bin"])
Use manually specified: /dev/cu.wchusbserial1d20
esptool -vv -cd nodemcu -cb 230400 -cp "/dev/cu.wchusbserial1d20" -cf .pioenvs/server_d1/firmware.bin
esptool v0.4.9 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to nodemcu
setting baudrate from 115200 to 230400
setting port from /dev/tty.usbserial to /dev/cu.wchusbserial1d20
espcomm_upload_file
espcomm_upload_mem
opening port /dev/cu.wchusbserial1d20 at 230400
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
Uploading 309008 bytes from .pioenvs/server_d1/firmware.bin to flash at 0x00000000
erasing flash
size: 04b710 address: 000000
first_sector_index: 0
total_sector_count: 76
head_sector_count: 16
adjusted_sector_count: 60
erase_size: 03c000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 15000
setting timeout 100
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................ [ 26% ]
................................................................................ [ 52% ]
................................................................................ [ 79% ]
..............................................................                   [ 100% ]
starting app without reboot
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
closing bootloader

See docs Espressif 8266 — PlatformIO v6.1 documentation

AUTH is required for OTA uploading (not for USB).

No worries, glad I know what caused my head scratching. It’s a shame that you can alternate between USB and OTA easily via command line when OTA Auth isn’t used. Only for the functionality to break if OTA Auth is used.

This is an internal error of esptool. Looks that it doesn’t understand this --auth without IP.