ESP-IDF 4.0-beta1 Environment variable problems

lhuxley
Posts: 5
Joined: Mon Oct 07, 2019 9:35 pm

ESP-IDF 4.0-beta1 Environment variable problems

Postby lhuxley » Tue Oct 08, 2019 11:00 am

I am on Windows 8.1 and I'm attempting to install ESP-IDF 4.0-beta1. After running "esp-idf-tools-setup-2.0.exe" to completion, a DOS command window with the appropriate environment appeared on the Windows desktop. There was no shortcut for this window on the desktop, but I did find the shortcut here:

"C:\Users\Huxley\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ESP-IDF"

(The desktop probably is a better place for the ESP-IDF shortcut, since the Start Menu is hidden on Windows after version 7, and most people do not know how to find it.)

Inside the command window, I found the following messages:

Code: Select all

Using Python in C:\Program Files\Python37\
Python 3.7.4
Using Git in C:\Program Files\Git\cmd
git version 2.21.0.windows.1
Setting IDF_PATH: c:\Users\Huxley\esp\esp-idf

Adding ESP-IDF tools to PATH...
Not using an unsupported version of tool cmake found in PATH: 3.15.4.
The input line is too long.
The syntax of the command is incorrect.

c:\users\Huxley\esp\esp-idf>
In the online instructions, it said to install the latest version of "cmake", however "tools.json" appears to be looking for version 3.13.4 instead of 3.15.4.

I commented out the "@ECHO OFF" statement at the top of ".espressif/idf_cmd_init.bat" and "esp-idf/export.bat", and I ran the ESP-IDF shortcut to find the cause of "The input line is too long." error message.

The error occurs in "esp-idf/export.bat" while it's manipulating the environment "path" variable. Where the error occurs, the string that represents the path variable has grown to more than 4400 characters. When I report the path variable from the ESP-IDF window, I see a couple of problems. The first part of the path variable is:

PATH=C:\Users\Huxley\.espressif\tools\esp32ulp-elf\2.28.51.20170517\esp32ulp-elf-binutils\bin;
C:\Users\Huxley\.espressif\tools\cmake\3.13.4\bin;
C:\Users\Huxley\.espressif\tools\openocd-esp32\v0.10.0-esp32-20190708\openocd-esp32\bin;
C:\Users\Huxley\.espressif\tools\idf-exe\1.0.1\;
C:\Users\Huxley\.espressif\tools\ccache\3.7\;
C:\Users\Huxley\.espressif\python_env\idf4.1_py3.7_env\Scripts;
c:\Users\Huxley\esp\esp-idf\tools;
C:\Program Files\Python37\;
C:\Program Files\Git\cmd;
PATH=C:\Program Files\Python27\;
C:\Program Files\Python27\Scripts;
C:\Program Files\Python37\Scripts\;
C:\Program Files\Python37\;

You can see that "PATH=" appears more than once in the path definition, which is unusual.

Elsewhere in the path, a large section of the path appears to be repeated, also indicating that something has gone wrong inside either .espressif/idf_cmd_init.bat or esp-idf/export.bat. The total length of the path after .espressif/idf_cmd_init.bat has completed is over 3000 characters. Without the repetition, it might be closer to 2000 characters.

I'm not a Windoows batch file expert, but the problem in esp-idf/export.bat may be an artifact of the fact that in an ordinary Windows command window, my path variable is just over 1600 characters.

As far as I know, the Windows path is limited to 4095 characters, while the maximum command line length is 8191 characters. That doesn't quite jibe with the error messages appearing in the ESP-IDF command window, but the limits within the batch processor may not be the same as they are at the command prompt.

lhuxley
Posts: 5
Joined: Mon Oct 07, 2019 9:35 pm

Re: ESP-IDF 4.0-beta1 Environment variable problems

Postby lhuxley » Tue Oct 08, 2019 4:13 pm

Above I mentioned "esp-idf-tools-setup-2.0.exe"... I should have said "esp-idf-tools-setup-2.1.exe".

I did some looking. In 2010, Raymond Chen (Microsoft) stated that the size limit on the whole environment is 32K Unicode characters. There is apparently no particular limit on the path variable, other than the suggested limit of 2048 characters per registry string. If Microsoft follows their own guidelines, then that would limit the path variable to 2048 characters, (actually 4096 characters with both system and user environment stores) but that would only limit the path that is preserved between reboots.

For the record, my current environment is about 12,600 bytes long, so the 32K limit shouldn't have affected the size of the path variable. The obvious limitation would be the buffer sizes of the command line and batch processors.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP-IDF 4.0-beta1 Environment variable problems

Postby ESP_igrr » Tue Oct 08, 2019 5:00 pm

Thank you for reporting the issue. Could you please attach (or send me by a PM) the value of your PATH environment variable before running export.bat?

lhuxley
Posts: 5
Joined: Mon Oct 07, 2019 9:35 pm

Re: ESP-IDF 4.0-beta1 Environment variable problems

Postby lhuxley » Tue Oct 08, 2019 7:06 pm

Thanks ESP_igrr,

My apologies. The path variable was exactly the problem. At some point, "PATH=" got prefixed to the path variable. That would have been the second "PATH=" that I reported. I have verified that that was what was tying the Espressif batch files in knots.

I have been trying to get a JTAG debugger to work for the past week with the stable ESP-IDF build. MSYS2 causes a lot of issues. I followed various instructions on the Espressif site as well as numerous on line tutorials. I assume that the path variable got corrupted while I was doing that.

I have now stripped all of the various IDF and ESP variables and paths from my static environment, and "esp-idf-tools-setup-2.1.exe" finally runs cleanly without intervention, at least until it attempts to register the Defender disables, (as I reported in another thread). That problem remains.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 78 guests