在扩展搜索idf,即可看到Espressif IDF,点击安装
按F1键,输入ESP-IDF:Configure ESP-IDF extension,打开配置页面,安装后似乎也会自动弹出配置页面
点击START
Python要求版本3.7及以上
继续Configure ESP-IDF
我下载了ESP-IDF包,所以这里选择Find ESP-IDF in your system
下载路径:
https://github.com/espressif/esp-idf/releases
对于github下载慢或者失败的,可以选择espressif的服务器下载
https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v4.1-beta1.zip
下载后解压即可,似乎路径不能包含空格
校验后继续,Go to ESP-IDF Tools setup
对于windows,ESP-IDF Tools手动下载地址在
Windows 平台工具链的标准设置 - ESP32 - — ESP-IDF 编程指南 latest 文档
当前2.3版本:https://dl.espressif.com/dl/esp-idf-tools-setup-2.3.exe
我是已经安装了,选择Skip ESP-IDF Tools download
一般是自动填好的,点击校验就好了
校验完成继续下一步,然后就是查看examples并用example创建工程测试
可以使用VS code左下角的工具编译和烧写
也可以使用菜单的终端命令编译和烧写
模板工程在扩展目录的templates文件夹中
C:\Users\XXX\.vscode\extensions\espressif.esp-idf-extension-0.2.1\templates
Click F1 to show Visual studio code actions, then type ESP-IDF to see possible actions.
Command Description | Keyboard Shortcuts (Mac) | Keyboard Shortcuts (Windows/ Linux) |
Configure ESP-IDF extension | ||
Create ESP-IDF project | ⌘ E C | Ctrl E C |
Add vscode configuration folder | ||
Configure Paths | ||
Set Espressif device target | ||
Device configuration | ||
Launch gui configuration tool | ||
Set default sdkconfig file in project | ||
Select port to use | ⌘ E P | Ctrl E P |
Build your project | ⌘ E B | Ctrl E B |
Flash your project | ⌘ E F | Ctrl E F |
Monitor your device | ⌘ E M | Ctrl E M |
Build, Flash and start a monitor on your device | ⌘ E D | Ctrl E D |
Pick a workspace folder | ||
Size analysis of the binaries | ⌘ E S | Ctrl E S |
Show ESP-IDF Examples Projects |
Verify ESP-IDF Tools给出配置的部分路径做参考:
idf4.0配置
D:\XXX\esp\esp-idf-tools\python_env\idf4.0_py3.8_env\Scripts;D:\XXXX\Python38;D:\XXX\esp\esp-idf-tools\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin;D:\XXX\esp\esp-idf-tools\tools\esp32ulp-elf\2.28.51.20170517\esp32ulp-elf-binutils\bin;D:\XXX\esp\esp-idf-tools\tools\cmake\3.13.4\bin;D:\XXX\esp\esp-idf-tools\tools\openocd-esp32\v0.10.0-esp32-20190313\openocd-esp32\bin;D:\XXX\esp\esp-idf-tools\tools\mconf\v4.6.0.0-idf-20190628;D:\XXX\esp\esp-idf-tools\tools\ninja\1.9.0;D:\XXX\esp\esp-idf-tools\tools\idf-exe\1.0.1;D:\XXX\esp\esp-idf-tools\tools\ccache\3.7
D:\XXX\esp\esp-idf-tools\tools\openocd-esp32\v0.10.0-esp32-20190313/openocd-esp32/share/openocd/scripts
idf4.1配置
D:\XXX\esp\esp-idf-tools\python_env\idf4.1_py3.8_env\Scripts;D:\XXXX\Python38;D:\XXX\esp\esp-idf-tools\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin;D:\XXX\esp\esp-idf-tools\tools\xtensa-esp32s2-elf\esp-2019r2-8.2.0\xtensa-esp32s2-elf\bin;D:\XXX\esp\esp-idf-tools\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin;D:\XXX\esp\esp-idf-tools\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;D:\XXX\esp\esp-idf-tools\tools\cmake\3.13.4\bin;D:\XXX\esp\esp-idf-tools\tools\openocd-esp32\v0.10.0-esp32-20191114\openocd-esp32\bin;D:\XXX\esp\esp-idf-tools\tools\mconf\v4.6.0.0-idf-20190628;D:\XXX\esp\esp-idf-tools\tools\ninja\1.9.0;D:\XXX\esp\esp-idf-tools\tools\idf-exe\1.0.1;D:\XXX\esp\esp-idf-tools\tools\ccache\3.7
D:\XXX\esp\esp-idf-tools\tools\openocd-esp32\v0.10.0-esp32-20191114/openocd-esp32/share/openocd/scripts
报错:python pip is not found in current environment
检查扩展工具里的idf:Python Bin Path Win路径配置配置,如下图
错误:
Verify Python packages requirements
Command failed: "D:\XXX\esp\esp-idf-tools\python_env\idf4.1_py3.8_env\Scripts\python.exe" "d:\XXX\esp\esp-idf-v4.1-beta1\tools\check_python_dependencies.py" -r "c:\Users\XXXXX\.vscode\extensions\espressif.esp-idf-extension-0.2.1\esp_debug_adapter\requirements.txt"
输出如下错误信息
The following Python requirements are not satisfied:
backports.functools-lru-cache>=1.5
graphviz
psutil>=5.5.1
pygdbmi>=0.9.0.0
pylint>=1.9.4
requests>=2.21.0
typing>=3.6.6
pywin32; platform_system == "Windows"
xmlrunner>=1.7.7
Please follow the instructions found in the "Set up the tools" section of ESP-IDF Getting Started Guide
Command failed: "D:\XXX\esp\esp-idf-tools\python_env\idf4.1_py3.8_env\Scripts\python.exe" "d:\XXX\esp\esp-idf-v4.1-beta1\tools\check_python_dependencies.py" -r "c:\Users\XXXXX\.vscode\extensions\espressif.esp-idf-extension-0.2.1\esp_debug_adapter\requirements.txt"
按照Please follow the instructions found in the "Set up the tools" section of ESP-IDF Getting Started Guide提示打开如下网址:
Get Started - ESP32 - — ESP-IDF Programming Guide latest documentation
按照Step 3. Set up the tools和Step 4. Set up the environment variables,打开CMD并进去esp-idf目录,比如我的是esp-idf-v4.1-beta1,执行install.bat和export.bat,然而其实没什么用,因为上面提示的错误实际是VS Code的Eepressif IDF扩展报的错误
执行如下命令下载依赖
D:\XXX\esp\esp-idf-tools\python_env\idf4.1_py3.8_env\Scripts\python.exe -m pip install -r c:\Users\XXXXX\.vscode\extensions\espressif.esp-idf-extension-0.2.1\esp_debug_adapter\requirements.txt
不要在CMD中直接使用pip install -r或者python -m pip去下载,因为你可能调用了系统中安装的python,下载后也还是继续报错的,esp-idf tools目录中有esp-idf tools自己的python.exe
如果还是失败,可以试下先按提示更新一下pip
0.6.0版本python环境配置命令记录:
D:\XXX\esp\esp-idf-tools\python_env\idf4.2_py3.8_env\Scripts\python.exe -m pip install --upgrade pip
D:\XXX\esp\esp-idf-tools\python_env\idf4.2_py3.8_env\Scripts\python.exe -m pip install -r c:\Users\XXX\.vscode\extensions\espressif.esp-idf-extension-0.6.0\requirements.txt
D:\XXX\esp\esp-idf-tools\python_env\idf4.2_py3.8_env\Scripts\python.exe -m pip install --no-warn-script-location -r c:\Users\XXX\.vscode\extensions\espressif.esp-idf-extension-0.6.0\esp_debug_adapter\requirements.txt
配置完成后的设置截图:
参考:
https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/index.html
https://blog.csdn.net/zztiger123/article/details/103811665
https://blog.csdn.net/Naisu_kun/article/details/84583785