ESP-IDF使用vscode选择目标芯片的问题
ESP-IDF使用VsCode选择目标芯片的问题
1. fullclean命令无法自动删除
d:\esp-idf\esp-idf\tools\check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Directory 'c:\users\huo_north2\desktop\esp-idf\sample_project\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.
该报错的大概意思是,build不是cmake构建的目录,所以fullclean命令拒绝删除此目录中的文件,需要手动删除该目录。
按照它说的删除就可以了。
2. 缓存中的环境变量与IDF_TARGET不匹配
d:\esp-idf\esp-idf\tools\check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'c:\users\huo_north2\desktop\esp-idf\sample_project\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32s3, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory c:\users\huo_north2\desktop\esp-idf\sample_project\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s3 -DCCACHE_ENABLE=1 c:\users\huo_north2\desktop\esp-idf\sample_project"...
CMake Error at D:/esp-idf/esp-idf/tools/cmake/targets.cmake:19 (message):
IDF_TARGET in CMake cache does not match IDF_TARGET environment variable.
To change the target, clear the build directory and sdkconfig file, and
build the project again
Call Stack (most recent call first):
D:/esp-idf/esp-idf/tools/cmake/project.cmake:7 (__target_init)
CMakeLists.txt:7 (include)
-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the c:\users\huo_north2\desktop\esp-idf\sample_project\build\log\idf_py_stderr_output_24052 and c:\users\huo_north2\desktop\esp-idf\sample_project\build\log\idf_py_stdout_output_24052
这个报错的大概意思是cmake缓存中的IDF_TARGET变量与IDF_TARGET不匹配,需要清除构建目录和sdkconfig文件,再重新构建项目(idf.py build)。
这个问题是核心要解决的,方案1当然是按照报错的提示进行操作,删除build文件夹以及sdkconfig文件(亲测无效)。
- 方案2:通过删除环境变量的方式解决问题(亲测无效)
- 方案3:通过设置环境变量值的方式解决问题(亲测无效)
- 方案4:通过命令面板进行修改(亲测有效)
- ctrl shift p调出命令面板
- 选择
ESP-IDF: Device Configuration
- 再选择Device Target
- 再选择具体的芯片
注意:记得在命令面板修改完成之后重新打开一个命令行窗口(start cmd)