Noobie - Trying to flash a github project to ESP32 - Got unexpected extra argument (upload)

PlatformIO Core, version 6.1.7

Absolutely brand new to PIO (Windows VS Studio code). I am using it to flash a home automation project GitHub - sidoh/esp8266_milight_hub: Replacement for a Milight/LimitlessLED hub hosted on an ESP8266 to an EsP32 WROOM DEV.

After building, and resolving Git missing client/Pio path issues, I am attempting to flash the project using the commands below:

set ESP_BOARD=nodemcuv2
platformio run -e $ESP_BOARD --target upload

Admittedly, my knowledge of the arguments is at best sketchy but I was surprised at the error message I received:

Error: Got unexpected extra argument (upload)

‘upload’ appears to be a valid target text value, as shown on the pio cli web page examples. I need help in understanding what should be in the -target value for flashing this project to an esp board.

I did run a list-targets command and got the following:

Environment    Group     Name    Title    Description
-------------  --------  ------  -------  -------------
nodemcuv2      Platform  upload  Upload

huzzah         Platform  upload  Upload

esp12          Platform  upload  Upload

d1_mini        Platform  upload  Upload

d1_mini_pro    Platform  upload  Upload

esp07          Platform  upload  Upload

Unsure as to whether platform.ini settings will help but I have pasted them below:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[common]
framework = arduino
platform = espressif8266@~1.8
board_f_cpu = 160000000L
lib_deps_builtin =
lib_deps_external =
  WiFiManager=https://github.com/sidoh/WiFiManager.git#cmidgley
  RF24@~1.3.2
  ArduinoJson@~6.10.1
  PubSubClient@~2.7
  https://github.com/ratkins/RGBConverter.git#07010f2
  WebSockets@~2.2.0
  CircularBuffer@~1.2.0
  PathVariableHandlers@~2.0.0
  RichHttpServer@~2.0.2
extra_scripts =
  pre:.build_web.py
test_ignore = remote
upload_speed = 460800
build_flags =
  !python3 .get_version.py
  # For compatibility with WebSockets 2.1.4 and v2.4 of the Arduino SDK
  -D USING_AXTLS
  -D MQTT_MAX_PACKET_SIZE=360
  -D HTTP_UPLOAD_BUFLEN=128
  -D FIRMWARE_NAME=milight-hub
  -D RICH_HTTP_REQUEST_BUFFER_SIZE=2048
  -D RICH_HTTP_RESPONSE_BUFFER_SIZE=2048
  -Idist -Ilib/DataStructures
# -D STATE_DEBUG
# -D DEBUG_PRINTF
# -D MQTT_DEBUG
# -D MILIGHT_UDP_DEBUG
# -D STATE_DEBUG

[env:nodemcuv2]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = nodemcuv2
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

[env:d1_mini]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = d1_mini
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

[env:esp12]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = esp12e
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

[env:esp07]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = esp07
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.1m64.ld -D FIRMWARE_VARIANT=esp07
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

[env:huzzah]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = huzzah
build_flags = ${common.build_flags} -D FIRMWARE_VARIANT=huzzah
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

[env:d1_mini_pro]
platform = ${common.platform}
framework = ${common.framework}
upload_speed = ${common.upload_speed}
board = d1_mini_pro
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini_PRO
extra_scripts = ${common.extra_scripts}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
test_ignore = ${common.test_ignore}

Iit was the ESP_BOARD that caused the issue. Hardcoded the environment parameter and the command ran

1 Like