Environment setup
When setting up ESP32-S2 environment using command idf.py set-target esp32s2
, an error occurred as “Error: No such command ‘set-target’”. What could be the reason?
The ESP-IDF is adapted to ESP32-S2 from release/v4.2, thus setting up ESP32-S2 environment in previous versions will cause errors. In this case, when using command
idf.py set-target esp32s2
, there will be error as “Error: No such command ‘set-target’”. It is recommended to perform tests and development on ESP32-S2 using ESP-IDF release/v4.2 and later versions. For more information, please refer to ESP32-S2 Get Started.For information on the support of different ESP chips by different ESP-IDF versions, please refer to ESP-IDF Release and SoC Compatibility.
When installing ESP-IDF version master using ESP-IDF Tools 2.3 in Windows system, an error occurred as: Installation has failed with exit code 2. What could be the reason?
This is related to the bad network environment. The Github repository cannot be downloaded smoothly under such network environment, causing SDK download failure on your PC. If you encounter Github access problems, it is recommended to use the offline version of the latest ESP-IDF Windows Installer.
During the installation process of esp-idf-tools on Windows, an exception occurs with the Python tool:
Installation has failed with exit code 1This error is caused by an unsuitable network environment. Please check the “Download via gitee” option when using the tool.
What should I do if I get Download failed: security channel support error
when installing build environment in the Windows system?
This is because the Windows system has disabled the default support for SSl3.0.
Solution: Go to Control Panel and find
Internet option
, selectAdvanced
, and check theuse SSL 3.0
option.
When executing export.bat in Windows system, what should I do if I get CMake and gdbgui version errors?
C:\Users\xxxx\.espressif\tools\cmake\3.16.4\bin The following Python requirements are not satisfied: gdbgui>=0.13.2.0This is because the upstream gdbgui has been updated, thus it is not compatible with the low version of python. The current solution is to manually modify the root file
requirements.txt
in ESP-IDF by changing the description of gdbgui version togdbgui==0.13.2.0
.
How to configure PATH
and IDF_PATH
when developing ESP32 and ESP8266 simultaneously?
For
PATH
, there is no need to do extra configurations. You can put them together as: export PATH=”$HOME/esp/xtensa-esp32-elf/bin:$HOME/esp/xtensa-lx106-elf/bin:$PATH”.For
IDF_PATH
, you can specify it for separate chips as:In ESP32 related projects, use
IDF_PATH = $(HOME)/esp/esp-idf
. In ESP8266 related projects, useIDF_PATH = $(HOME)/esp/ESP8266_RTOS_SDK
.
Do I need to use command idf.py set-target
every time when switching to another project?
When building the project with
idf.py build
, the target is determined as follows:
If the build directory
build
already exists, the system will use the target the project was previously built for. It is stored in CMakeCache.txt file in thebuild
directory.Alternatively, if the build directory doesn’t exist, the system will check if the
sdkconfig
file exists, and use the target specified there.If both the build directory and
sdkconfig
file exist with different targets specified, the system will report an error. This shouldn’t happen normally, unlesssdkconfig
was changed manually without deleting the build directory.If neither
sdkconfig
file nor build directory exists, it can be considered to useIDF_TARGET
to set the target as a CMake variable or environment variable. If this variable is set and is different from the target specified insdkconfig
or in the build directory, the system will also report an error.Finally, if
sdkconfig
doesn’t exist, build directory doesn’t exist, and the target is not set viaIDF_TARGET
, then the system will use the default value. The default value can be set insdkconfig.defaults
.If the target isn’t set using any of the above methods, then the system will build for ESP32 target.
To answer your question:
idf.py set-target
stores the selected target in the project’s build directory andsdkconfig
file, not in the terminal environment. So, once the project is configured and built once for a certain target, if you switch to a different directory and build another project, then come back, the target will not change, and will be the same as previously set for this project. And it’s not necessary to runidf.py set-target
again other than to switch to a different target.If you want to make the project built for certain target by default, add
CONFIG_IDF_TARGET="esp32s2"
to thesdkconfig.defaults
file of the project. After this, ifsdkconfig
file doesn’t exist and build directory doesn’t exist, idf.py build command will build for that target specified insdkconfig.defaults
.
idf.py set-target
command can still be used to override the default target set insdkconfig.defaults
.
How to know the version of ESP-IDF, is it recorded in a certain document?
Command line: You can obtain the version number by inputting
idf.py --version
in the terminal with an IDF environment.CMake script: You can obtain the version number through the variable
${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}
.Code compilation: You can obtain the version number by calling
esp_get_idf_version
during code compilation or directly using the macro definition of version in “components/esp_common/include/esp_idf_version.h”.
How to optimize ESP-IDF compilation in Windows environment?
Please add the directories of ESP-IDF source code and compiler
.espressif
to the exclusions of anti-virus program.
Is there an esptool that can be used directly on Windows?
You can go to esptool –> Releases and download the Windows version of the esptool from the Asset column on the drop-down page.
What could be the cause of the error KeyError: ‘idfSelectedId’ when running . /install.sh?
This is because ESP-IDF v5.0 or above is installed on your system. You can check the configuration in the ~/.espressif/idf-env.json file.
This error can be solved by running rm -rf ~/.espressif/idf-env.json.
When running demo, the package manager component dependency cannot be pulled, with the failure information Invaild manifest format, Invalid dependency format, and unknown keys in dependency details: override_path. What could be the reason?
This is due to missing component dependencies and can be solved after updating component-manager. The corresponding command is pip install –upgrade idf-component-manager.
After installing the ESP-IDF CMD environment using the ESP-IDF v4.4.8-Offline Installer package, why does the following compilation error occur when directly compiling the hello_world example?
[1050/1065] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj D:\esp\Espressif\tools\xtensa-esp32-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe: error: @-file refers to a directory [1058/1065] Building C object esp-idf/wifi_provisioning/CMakeFiles/__idf_wifi_provisioning.dir/src/scheme_softap.c.obj ninja: build stopped: subcommand failed. ninja failed with exit code 1
According to the logs, an error occurred while caching the build/esp-idf/main/CMakeFiles/__idf_main.dir/ main.c.o.bj file during the compilation process. This file is generated when ccache calls the compiler and is related to the compilation cache. This issue has been resolved in versions 5.0 and later.
In the ESP-IDF CMD environment of version v4.4, please use the idf.py –no-ccache build command to build the projects.