problem with esptool.py

User avatar
mzimmers
Posts: 393
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

problem with esptool.py

Postby mzimmers » Mon Dec 02, 2019 10:13 pm

Hi all -

Since migrating to V4 of the IDF (under Windows), I've run into an issue using esptool.py. Whereas I used to be able to run a command like this:

Code: Select all

C:\esp32_projects\wifibutton>esptool.py write_flash 0x9000 nvs_reuse.bin
I now have to do it like this:

Code: Select all

C:\esp32_projects\wifibutton>python C:\esp32_toolchain\python_env\idf4.0_py3.7_env\Lib\site-packages\esptool.py write_flash 0x9000 nvs_reuse.bin
Obviously not convenient. If I attempt to run it the old way, it's as though the arguments aren't getting passed through to the script. Did I miss a step in the installation, or is there some workaround I'm not aware of?

Thanks...

ESP_Angus
Posts: 1897
Joined: Sun May 08, 2016 4:11 am

Re: problem with esptool.py

Postby ESP_Angus » Wed Dec 04, 2019 3:01 am

Hi mzimmers,

Are you using the IDF Command Prompt, or MSYS2, or something else?

The V4.0 Windows installer setups a Python virtualenv with a dedicated copy of Python and its own set of installed Python modules. If you run the IDF Command Prompt then you'll be inside this Python environment.

The fact that there is a file "idf4.0_py3.7_env\Lib\site-packages\esptool.py" suggests that "pip install esptool" has been run while inside the virtualenv. This is not required by ESP-IDF but it's fine, doesn't harm anything (ESP-IDF will use the copy of esptool inside IDF_PATH/components/esptool_py/esptool).

If you're using IDF Command Prompt, then because esptool was installed with pip in the virtualenv then you should be able to run "esptool.py write_flash 0x9000 nvs_reuse.bin" without needing anything else. If it doesn't work in the virtualenv, try running "pip install esptool" again.

If you're using a different command prompt, the solution may be different. Running "esptool.py" with the default Python environment (ie a normal Command Prompt) may work depending on how the Windows python installation is configured.

User avatar
mzimmers
Posts: 393
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: problem with esptool.py

Postby mzimmers » Wed Dec 04, 2019 3:05 am

Hi Angus - yes, I am running the ESP-IDF Command Prompt. (I was using MYSYS2 when working with V3 of the IDF).

I'll try re-installing esptool again tomorrow and report back.

Thanks...

User avatar
mzimmers
Posts: 393
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: problem with esptool.py

Postby mzimmers » Wed Dec 04, 2019 2:53 pm

No luck.

When I start up the ESP-IDF Command Prompt, here's what I get:

Code: Select all

Using Python in C:\Users\mzimmers.CYBERDATA\AppData\Local\Programs\Python\Python37\
Python 3.7.3
Using Git in C:\Program Files\Git\bin\
git version 2.21.0.windows.1
Setting IDF_PATH: C:\esp-idf

Adding ESP-IDF tools to PATH...
    C:\esp32_toolchain\tools\xtensa-esp32-elf\esp32-2019r1-8.2.0\xtensa-esp32-elf\bin
    C:\esp32_toolchain\tools\esp32ulp-elf\2.28.51.20170517\esp32ulp-elf-binutils\bin
    C:\esp32_toolchain\tools\cmake\3.13.4\bin
    C:\esp32_toolchain\tools\openocd-esp32\v0.10.0-esp32-20190313\openocd-esp32\bin
    C:\esp32_toolchain\tools\mconf\v4.6.0.0-idf-20190628\
    C:\esp32_toolchain\tools\ninja\1.9.0\
    C:\esp32_toolchain\tools\idf-exe\1.0.1\
    C:\esp32_toolchain\tools\ccache\3.7\
    C:\esp32_toolchain\python_env\idf4.0_py3.7_env\Scripts
    C:\esp-idf\tools

Checking if Python packages are up to date...
Python requirements from C:\esp-idf\requirements.txt are satisfied.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build


C:\esp-idf>
And when I try to run esptool.py, here's the (start of) output:

Code: Select all

C:\esp32_projects\wifibutton\mfg>esptool.py write_flash 0x9000 nvs_reuse.bin
esptool.py v2.8
usage: esptool [-h] [--chip {auto,esp8266,esp32}] [--port PORT] [--baud BAUD]
               [--before {default_reset,no_reset,no_reset_no_sync}]
               [--after {hard_reset,soft_reset,no_reset}] [--no-stub]
The output is the same whether I execute the command with no parameters, or with nonsense parameters.

plusorc
Posts: 15
Joined: Sat Nov 09, 2019 6:27 am

Re: problem with esptool.py

Postby plusorc » Wed Dec 04, 2019 3:24 pm

@mzimmers
Can you test this ?
Put the full address of the Bin file you're flashing .. not the IDF environment
I recently has a similar issue and it was esptool needing the full path of the Bin file


@ESP_Angus
With all due respect , I found the IDF Command in windows is very inconvenient
I wish there is a way to add those to the Path and be able to run idf.py from any directory .
I use vscode and can't find a way to invoke idf.py from vscode , because I have to use the IDF command
If I copy the link of the shortcut , I get "This has to be run from ...."
a message telling that I have to be in the directory to use the idf.py

User avatar
mzimmers
Posts: 393
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: problem with esptool.py

Postby mzimmers » Wed Dec 04, 2019 6:41 pm

Hi plusorc - thanks for the suggestion. I'm really more interested, however, in getting the command to work the way that Angus says it should. I probably messed up something with my install; I'm hoping that someone might have an idea exactly where to look.

Who is online

Users browsing this forum: Google [Bot], maldus and 18 guests