乐鑫技术交流
直播中

郝埃连

7年用户 1344经验值
私信 关注
[问答]

求助,关于使用vscode新建编译环境的问题求解

各位大佬求助一下。新人小白刚接触。
1.本人参照官网教程快速入门走了一遍,确实可以使用终端可以把ESP32_S2的helloworld和blink编译,烧录进。
2.然后按照bilibili上的视频,按照vscode编译环境。首先发现视频上的插件版本和 当前的使用的插件版本是有点区别。
3.本人先使用esp-idf-tools-setup-offline-2.8.exe 已安装的情况进行VSCODE配置。拷贝例程直接就报 “头文件”的问题,然后转变方向。
4.先再卸载之前安装的esp-idf-tools,删除之前的idf文件夹和tools文件夹,恢复到原来的状态。
5.先安装Git-2.31.1-64-bit.exe、python-3.9.5-amd64.exe默认安装,VSCODE插件选择在线高级安装,等待下载安装,期间出现几次错误,重新继续安装得到安装完成。
6.拷贝例程进行编译。再次报错。如下:
Executing task: cmake -G Ninja .. <

-- Building ESP-IDF components for target esp32
-- Checking Python dependencies...
The following Python requirements are not satisfied:
pyserial>=3.0
cryptography>=2.1.4
pyparsing>=2.0.3,<2.4.0
pyelftools>=0.22
gdbgui==0.13.2.0
reedsolo>=1.5.3,<=1.5.4
bitstring>=3.1.6
ecdsa>=0.16.0
esp-windows-curses; sys_platform == 'win32'
To install the missing packages, please run "c:UsersAdministratorespesp-idfinstall.bat"
Diagnostic information:
    IDF_PYTHON_ENV_PATH: c:UsersAdministrator.espressifpython_envidf4.2_py3.9_env
    Python interpreter used: c:UsersAdministrator.espressifpython_envidf4.2_py3.9_envScriptspython.exe
CMake Error at C:/Users/Administrator/esp/esp-idf/tools/cmake/build.cmake:271 (message):
  Some Python dependencies must be installed.  Check above message for
  details.
Call Stack (most recent call first):
  C:/Users/Administrator/esp/esp-idf/tools/cmake/build.cmake:397 (__build_check_python)
  C:/Users/Administrator/esp/esp-idf/tools/cmake/project.cmake:395 (idf_build_process)
  CMakeLists.txt:6 (project)

请问大佬问题出在哪里?搞了3天了,头有点大了。然后又去使用esp-idf-tools-setup-online-2.8.exe在线重新安装了tools,使用终端调用vscode创建的例程是可以编译的。但是vscode就是不行。


-- Configuring incomplete, errors occurred!
See also "C:/Users/Administrator/esp/esp-idf/blink/build/CMakeFiles/CMakeOutput.log".
The terminal process "C:WINDOWSSystem32WindowsPowerShellv1.0powershell.exe -Command cmake -G Ninja .." terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
                                                                                                                                                                                                                        
               

回帖(1)

郭中

2024-6-22 15:37:36
根据您提供的信息,我将为您提供一个详细的步骤来在VSCode中配置ESP32_S2的编译环境。请按照以下步骤操作:

1. 首先,确保您已经安装了以下软件:
   - Git:https://git-scm.com/download/win
   - Python 3.9:https://www.python.org/downloads/release/python-395/

2. 安装VSCode:https://code.visualstudio.com/download

3. 打开VSCode,安装以下插件:
   - C/C++ (ms-vscode.cpptools):用于C/C++语言支持
   - CMake Tools:用于CMake构建系统
   - Cortex-Debug:用于调试ESP32

4. 下载并安装ESP-IDF:
   - 打开终端(在VSCode中按Ctrl+`),输入以下命令:
     ```
     git clone -b v4.4 --recursive https://github.com/espressif/esp-idf.git
     ```
   - 注意:这里使用的是v4.4版本,您可以根据需要选择其他版本。

5. 配置环境变量:
   - 将Python添加到系统环境变量PATH中。
   - 将ESP-IDF的`export.sh`脚本添加到系统环境变量PATH中。例如,如果您的ESP-IDF路径是`C:esp-idf`,则将`C:esp-idfexport.bat`添加到PATH。

6. 打开VSCode,打开一个文件夹(例如,您下载的ESP-IDF文件夹)。

7. 配置CMake:
   - 打开VSCode的设置(按Ctrl+,),搜索“CMake”,找到“CMake: Install Path”,将其设置为ESP-IDF的`tools`文件夹路径,例如:`C:esp-idftoolscmake3.16.4bin`。

8. 配置C/C++:
   - 打开VSCode的设置(按Ctrl+,),搜索“C_Cpp”,找到“C_Cpp.default.intelliSenseMode”,将其设置为`gcc-x64`。
   - 找到“C_Cpp.default.compilerPath”,将其设置为ESP-IDF的`tools`文件夹中的`xtensa-esp32s2-elf-gcc`路径,例如:`C:esp-idftoolsxtensa-esp32s2-elfesp-2020r3-8.4.0xtensa-esp32s2-elfbingcc`.

9. 配置Cortex-Debug:
   - 打开VSCode的设置(按Ctrl+,),搜索“Cortex-Debug”,找到“Cortex-Debug.openocdPath”,将其设置为ESP-IDF的`components`文件夹中的`openocd`路径,例如:`C:esp-idfcomponentsopenocd-esp32esp32-apptrace`.

10. 现在,您应该可以在VSCode中编译和烧录ESP32_S2的示例项目了。在VSCode中打开一个示例项目(例如,`examples/get-started/hello_world`),然后使用CMake Tools构建和烧录项目。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分