ESP32: esptool: error: too few arguments


#21

Still the same result.

What can/should I remove to get it to work again?
At this moment I am even willing to completely wipe the hard drive and do a full re-install + perform a rain-dance.


#22

OK, it seems the bin file is not included in the 2nd esptool.py command.

I just did this from within the terminal and it does do some uploading:

C:\Arduino\ESPeasy\arduino-1.8.3\portable\sketchbook\ESPEasy_Gijs\ESPEasy>"c:\users\gijs\.platformio\penv\scripts\python.exe" "C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptool.py" --chip esp32 --port "COM9" --baud 460800 write_flash 0x00000 .pioenvs\esp32dev\firmware.bin
esptool.py v2.3.1
Connecting........__
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1109312 bytes to 639989...
Wrote 1109312 bytes (639989 compressed) at 0x00000000 in 15.5 seconds (effective 570.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

The compiled file doesn’t do what I expect it to do, but maybe the offset (0x00000) is not correct?


#23

See

Do you use official platform = espressif32 dev/platform?


#24

Hmm looks like I wrote it to the wrong address.

#platform         = espressif32@1.0.1
platform         = https://github.com/platformio/platform-espressif32.git#feature/stage

Tried both these. The last one is currently active.
Last week it was still @0.12.0
It is this config:


#25

I’ve just tried the latest staging version and it works for me. See

"/Volumes/SOFT/Projects/GitHub/platformio/origin/.tox/develop/bin/python" "/Users/ikravets/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 elf2image --flash_mode dio --flash_freq 40m --flash_size 4MB -o .pioenvs/esp32dev/firmware.bin .pioenvs/esp32dev/firmware.elf
esptool.py v2.3.1

Could you also provide an output of pio platform show espressif32?


#26
PS C:\Arduino\ESPeasy\arduino-1.8.3\portable\sketchbook\ESPEasy_Gijs\ESPEasy> pio platform show espressif32
>>
espressif32 ~ Espressif 32 (Stage)
==================================
Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications.


Version: 77cb4bc
Home: http://platformio.org/platforms/espressif32
Repository: https://github.com/platformio/platform-espressif32.git
Vendor: https://espressif.com/
License: Apache-2.0
Frameworks: arduino, espidf, pumbaa, simba

Packages
--------

Package toolchain-xtensa32
--------------------------
Type: toolchain
Requirements: ~2.50200.0
Installed: Yes
Version: 2.50200.80
Original version: 5.2.0
Description: GCC for SoC Xtensa L108

Package tool-openocd-esp32
--------------------------
Type: debugger
Requirements: ~1.1000.0
Installed: No (optional)

Package framework-simba
-----------------------
Type: framework
Requirements: >=12.2.0
Installed: No (optional)

Package tool-mkspiffs
---------------------
Type: uploader
Requirements: ~2.230.0
Installed: Yes
Version: 2.230.0
Original version: 2.30
Description: Tool to build and unpack SPIFFS images

Package framework-arduinoespressif32
------------------------------------
Type: framework
Requirements: https://github.com/espressif/arduino-esp32.git
Installed: Yes
Version: 89859f7
Original version: None
Description: Arduino Wiring-based Framework (ESP32 Core)


Package framework-pumbaa
------------------------
Type: framework
Requirements: >=2.3.0
Installed: No (optional)

Package tool-espotapy
---------------------
Type: uploader
Requirements: ~1.1.0
Installed: Yes
Version: 1.1.0
Original version: None
Description: This script will push an OTA update to the ESP

Package framework-espidf
------------------------
Type: framework
Requirements: ~2.300.0
Installed: No (optional)

Package tool-esptoolpy
----------------------
Type: uploader
Requirements: ~1.20310.0
Installed: Yes
Version: 1.20310.0
Original version: 2.3.10
Description: ESP8266 and ESP32 serial bootloader utility

Boards
------
ID                    MCU            Frequency  Flash   RAM    Name
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
esp32-evb             ESP32          240MHz    1.25MB  288KB  OLIMEX ESP32-EVB
wemosbat              ESP32          240MHz    1.25MB  288KB  WeMos WiFi & Bluetooth Battery
esp32thing            ESP32          240MHz    1.25MB  288KB  SparkFun ESP32 Thing
m5stack-core-esp32    ESP32          240MHz    1.25MB  288KB  M5Stack Core ESP32
nano32                ESP32          240MHz    1.25MB  288KB  MakerAsia Nano32
espectro32            ESP32          240MHz    1.25MB  288KB  ESPectro32
pocket_32             ESP32          240MHz    1.25MB  288KB  Dongsen Tech Pocket 32
quantum               ESP32          240MHz    1.25MB  288KB  Noduino Quantum
node32s               ESP32          240MHz    1.25MB  288KB  Node32s
heltec_wifi_kit_32    ESP32          240MHz    1.25MB  288KB  Heltec WIFI Kit 32
esp32doit-devkit-v1   ESP32          240MHz    1.25MB  288KB  DOIT ESP32 DEVKIT V1
espea32               ESP32          240MHz    1.25MB  288KB  April Brother ESPea32
esp32dev              ESP32          240MHz    1.25MB  288KB  Espressif ESP32 Dev Module
lolin32               ESP32          240MHz    1.25MB  288KB  WEMOS LOLIN32
onehorse32dev         ESP32          240MHz    1.25MB  288KB  Onehorse ESP32 Dev Module
nodemcu-32s           ESP32          240MHz    1.25MB  288KB  NodeMCU-32S
esp-wrover-kit        ESP32          240MHz    1.25MB  4MB    Espressif ESP-WROVER-KIT
esp32-gateway         ESP32          240MHz    1.25MB  288KB  OLIMEX ESP32-GATEWAY
hornbill32minima      ESP32          240MHz    1.25MB  288KB  Hornbill ESP32 Minima
esp320                ESP32          240MHz    1.25MB  288KB  Electronic SweetPeas ESP320
heltec_wifi_lora_32   ESP32          240MHz    1.25MB  288KB  Heltec WIFI LoRa 32
intorobot             ESP32          240MHz    1.25MB  288KB  IntoRobot Fig
hornbill32dev         ESP32          240MHz    1.25MB  288KB  Hornbill ESP32 Dev
nina_w10              ESP32          240MHz    1.25MB  288KB  u-blox NINA-W10 series
widora-air            ESP32          240MHz    1.25MB  288KB  Widora AIR
esp32vn-iot-uno       ESP32          240MHz    1.25MB  288KB  ESP32vn IoT Uno
mhetesp32devkit       ESP32          240MHz    1.25MB  288KB  MH ET LIVE ESP32DevKIT
pico32                ESP32          240MHz    1.25MB  288KB  ESP32 Pico Kit
microduino-core-esp32 ESP32          240MHz    1.25MB  288KB  Microduino Core ESP32
featheresp32          ESP32          240MHz    1.25MB  288KB  Adafruit ESP32 Feather
firebeetle32          ESP32          240MHz    1.25MB  288KB  FireBeetle-ESP32
mhetesp32minikit      ESP32          240MHz    1.25MB  288KB  MH ET LIVE ESP32MiniKit
espino32              ESP32          240MHz    1.25MB  288KB  ESPino32

Oh and the problem is not into building it, that’s fine.
It is the upload that’s failing.


#27

Where in the PlatformIO should these parameters for ESPtool flash upload be set?
I find it really odd that my system is apparently so messed-up right now that I cannot upload to ESP32 anymore from PlatformIO.
I tested on Atom and VScode, but both refuse to work.
So is there anything I can set in the .ini file to make it work again?


#28

Finally I was able to do manual flash of my own compiled ESP32 binary again.

Run in terminal:
esptool --before default_reset --after hard_reset --chip esp32 --port "COM9" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\sdk\bin\bootloader_dio_40m.bin 0x8000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\default.bin 0xe000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\boot_app0.bin 0x10000 .pioenvs\esp32dev\firmware.bin

But now the big question:
How to make PlatformIO generate this line automatically again?

And what is changed with the 1.0.1 version? The 0.12.0 version worked fine with the line above, but the 1.0.1 does not work with that line.


#29
  1. Please check that you don’t have http://docs.platformio.org/en/latest/faq.html#multiple-pio-cores-in-a-system
  2. Please remove C:\.platformio and HOME_DIR/.platformio folders
  3. Please check that you don’t have a custom http://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_HOME_DIR

It seems that you have broken build scripts for esp32 dev/platform.


#30

I double (triple) checked and made sure all platformio related folders are removed.
Python was already uninstalled and before uninstalling that it was stripped of any platformio installed package.
There are no platformio related settings in the environment.
I just tested with platform = espressif32@1.0.2 and @0.12.0 and last night I tested with https://github.com/platformio/platform-espressif32.git#develop

Atom has been re-installed, PlatformIO has been reinstalled many, many times.
All MS-related dev tools are removed from my system.
Latest updates are installed, just to make sure.
Curren PlatformIO version reported is: Home 0.9.6·Core 3.6.0a1
And still the same error when flashing.

With my own command to flash, I cannot flash anything built newer than @0.12.0, but that may have something to do with used offsets, partition layouts, or one of the many other new features perhaps.
It will flash, but the resulting firmware is unusable.

I’m very close to calling a format-C and reinstall my entire laptop (which will take a lot of time to setup like it should be).


#31

Do you have a custom partition table? Could you try to create new/clean simple project and try to flash it? Do you have extra scripts in project?


#32

We don’t use extra scripts in the project.
And as far as I know, it is just the default partition table.

We’re just in the process of including ESP32 in the same project (ESPeasy, see platformio.ini)
So we can still change everything if there are bad choices made regarding ESP32.

I was planning to get to bed a bit early today, so testing a new clean/simple project I’d rather do tomorrow, since it is already close to 23h30.


#33

Same deal with my setup. esptool: error: too few arguments


#34

Do you use Windows too?


#35

Yes, Windows 10 here.


#36
  1. Please open system terminal cmd.exe (not in IDE) and type pip list. Please share an output here
  2. Please provide your platformio.ini.

Don’t forget to run in PIO IDE Terminal: pio update and pio upgrade --dev.

P.S: I’ve just tried to build “arduino-blink” project from example on my VM Win10 and can’t reproduce this issue.


#37

1:
pip 10.0.1
setuptools 39.0.1

2:
https://www.dropbox.com/s/qwuzktx8kzbgrdo/platformio.ini?dl=1

I also did the updates. But I got other software with dependencies using 2.7 and some use 3.6… different locations each one. Only C:\Users\Jimmy.platformio\python27\ is found in PATH though.

So I still get the same error.


#38

Just some feedback. My build log state that esptool 2.1 is used, not 2.3.1. Could that be of importance?


#39

Something is wrong with your installation. Please remove C:\Users\Jimmy\.platformio folder and build project again.

Also, please use the latest esp32 dev platform.


#40

Today I updated PlatformIO to Core 3.6.0a2 and now I cannot even run my “magic line” anymore to flash it by hand.

So now my test system can only build ESP32 code and I see no way anymore to flash it to the node :angry:

PS C:\Arduino\ESPeasy\arduino-1.8.3\portable\sketchbook\ESPEasy_Gijs\ESPEasy> esptool --before default_reset --after hard_reset --chip esp32 --port "COM9" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flas
h_freq 40m --flash_size detect 0x1000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\sdk\bin\bootloader_dio_40m.bin 0x8000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\default.bi
n 0xe000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\boot_app0.bin 0x10000 .pioenvs\esp32dev\firmware.bin
esptool : The term 'esptool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ esptool --before default_reset --after hard_reset --chip esp32 --port ...
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (esptool:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Arduino\ESPeasy\arduino-1.8.3\portable\sketchbook\ESPEasy_Gijs\ESPEasy> "c:\users\gijs\.platformio\penv\scripts\python.exe" "C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptool.py" --before default_reset --after hard_reset --chip esp32 -
-port "COM9" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\sdk\bin\bootloader_dio_40m.b
in 0x8000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\default.bin 0xe000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\boot_app0.bin 0x10000 .pioenvs\esp32dev\firmwa
re.bin
At line:1 char:53
+ ... python.exe" "C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptoo ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptool.py"' in expression or statement.
At line:1 char:118
+ ... gijs\.platformio\packages\tool-esptoolpy\esptool.py" --before default ...
+                                                            ~~~~~~
Unexpected token 'before' in expression or statement.
At line:1 char:53
+ ... python.exe" "C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptoo ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The '--' operator works only on variables or on properties.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Edit:
Running this in a command shell finally worked (running ESP32@0.12.0 by the way)

C:\Users\gijs\.platformio\penv\Scripts\activate.bat
"c:\users\gijs\.platformio\penv\scripts\python.exe" "C:\Users\gijs\.platformio\packages\tool-esptoolpy\esptool.py" --chip esp32 --port "COM9" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\sdk\bin\bootloader_dio_40m.bin 0x8000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\default.bin 0xe000 C:\Users\gijs\.platformio\packages\framework-arduinoespressif32@1.4.0\tools\partitions\boot_app0.bin 0x10000 C:\Arduino\ESPeasy\arduino-1.8.3\portable\sketchbook\ESPEasy_Gijs\ESPEasy\.pioenvs\esp32dev\firmware.bin