VS code下载网址: ——现版本安装包大小大约60M左右,是一个轻量级但功能强大的源代码编辑器,适用于Windows、macOS和Linux。支持安装扩展各类应用插件。
https://code.visualstudio.com/docs/?dv=win
需以管理员模式运行VS code(Python下载文件时可能会出现以下错误:Cache entry deserialization
failed, entry ignored)
下载espress IDF插件:
下载完插件后,按下Ctrl+Shift+p输入: espidf configure extension,回车,即可进行IDF插件的配置界面
以上提示: 1. 需要提前装好Git与Python应用(如果你的电脑已经安装过git或者Python则不用重新安装,
VScode会自动找到用户软件安装路径,前提你没有安装后修改软件目录)
2. 是否每次开机时打开这个画面
3. 配置保存在哪里
其中Python版本要求:Python 3.7+,Git无版本限制,安装Python时记得勾选生效全局变量文件,忘
记勾选也可以在全局变量PATH中新增:
Python\Python39\ Python\Python39\Scripts,这两项。
随后点击START,即可进行工具链目录配置,当然前提是你的PC端已经安装好Git/Python,及ESP_IDF依赖包进入Python路径选择界面,之前我下载过其他版本的Python,VScode将安装的路径都一一罗列,可以到‘我的电脑’查看是否存在该路径并确认Python版本号。
这里我选择了D盘的Python3.6.4版本(错误示范),选择完毕,点击配置ESP-IDF。
随后进入的是ESP-IDF依赖包工具配置界面,此处的配置有两种方法:
一. 在线下载,选择你所要安装的版本,选择下载目录,随后点击‘Click here to download’即可开始下
载安装,不过由于是外网下载可能很慢,所以以下提供ESP-IDF百度云链接,可以通过方法二进行配置安装。
二. 离线下载,选择‘在系统中查询ESP-IDF版本’,随后找到全部解压后的ESP-IDF路径中的esp-idf v4.1文件夹,最后点击‘Click here to check if is valid’验证路径中是否存在ESP-IDF。
验证成功将出现路径的版本信息与idf.py工具存在。最后点击’ESP-IDP Tools setup’,进行ESP-IDF工具依赖安装。
此处无论你是使用离线下载或者在线下载的方式,都需要选择’Download ESP-IDF Tools’。另一个选项为跳过安装直接进入工具链环境安装验证。
如果你是离线下载好的工具链则选择工具链文件夹的上一级目录,但注意不要选择工具链文件夹内,它的下载规则是在指定目录新建文件夹并下载工具链,如果已经存在对应文件就将跳过下载。如果你是在线下载的只需选择下载路径,点击Download,接下来只需等待下载安装。
解析到对应下载文件后,其会把对应压缩包解压安装,接下来进行等待工具链安装完毕即可。
此处可能会要求你进行环境变量添加,此处还没验证不添加有何错误:
工具链安装编译日志:
idf_versions.txt has (1) KB idf_versions.txt progress: 100.00% (0.08 / 0.08) KB Saving D:\Anaconda\python.exe to create python virtual environment. Downloading Toolchain for Xtensa (ESP32) based on GCC xtensa-esp32-elf-gcc8_2_0-esp-2020r2-win64.zip has (104009) KB xtensa-esp32-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 0.02% (15.64 / 104008.97) KB xtensa-esp32-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 0.03% (31.64 / 104008.97) KB … xtensa-esp32-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 100.00% (104008.97 / 104008.97) KB Downloading Toolchain for Xtensa (ESP32-S2) based on GCC xtensa-esp32s2-elf-gcc8_2_0-esp-2020r2-win64.zip has (104360) KB xtensa-esp32s2-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 0.01% (15.64 / 104359.95) KB xtensa-esp32s2-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 0.03% (31.64 / 104359.95) KB … xtensa-esp32s2-elf-gcc8_2_0-esp-2020r2-win64.zip progress: 100.00% (104359.95 / 104359.95) KB Downloading Toolchain for ESP32 ULP coprocessor Failed download. Retrying… Error: HTTP/HTTPS Request error https://github.com/espressif/binutils- esp32ulp/releases/download/v2.28.51-esp-20191205/binutils-esp32ulp-win32- 2.28.51-esp-20191205.zip Waiting 8 seconds… Failed download. Retrying…
Error: HTTP/HTTPS Request error https://github.com/espressif/binutils- esp32ulp/releases/download/v2.28.51-esp-20191205/binutils-esp32ulp-win32- 2.28.51-esp-20191205.zip Waiting 16 seconds… Failed download. Retrying… Error: HTTP/HTTPS Request error https://github.com/espressif/binutils- esp32ulp/releases/download/v2.28.51-esp-20191205/binutils-esp32ulp-win32- 2.28.51-esp-20191205.zip false Downloading Toolchain for Xtensa (ESP32) based on GCC Found xtensa-esp32-elf in f:\espidf_vs\dist Downloading Toolchain for Xtensa (ESP32-S2) based on GCC Found xtensa-esp32s2-elf in f:\espidf_vs\dist Downloading Toolchain for ESP32 ULP coprocessor Found esp32ulp-elf in f:\espidf_vs\dist Downloading Toolchain for ESP32-S2 ULP coprocessor Found esp32s2ulp-elf in f:\espidf_vs\dist Downloading CMake build system Found cmake in f:\espidf_vs\dist Downloading OpenOCD for ESP32 Found openocd-esp32 in f:\espidf_vs\dist Downloading Ninja build system Found ninja in f:\espidf_vs\dist Downloading IDF wrapper tool for Windows Found idf-exe in f:\espidf_vs\dist Downloading Ccache (compiler cache) Found ccache in f:\espidf_vs\dist Installing package Toolchain for Xtensa (ESP32) based on GCC Installing zip package Toolchain for Xtensa (ESP32) based on GCC Installing package Toolchain for Xtensa (ESP32-S2) based on GCC Installing zip package Toolchain for Xtensa (ESP32-S2) based on GCC Installing package Toolchain for ESP32 ULP coprocessor Installing zip package Toolchain for ESP32 ULP coprocessor Installing package Toolchain for ESP32-S2 ULP coprocessor Installing zip package Toolchain for ESP32-S2 ULP coprocessor Installing package CMake build system Installing zip package CMake build system Installing package OpenOCD for ESP32 Installing zip package OpenOCD for ESP32 Installing package Ninja build system Installing zip package Ninja build system Installing package IDF wrapper tool for Windows Installing zip package IDF wrapper tool for Windows Installing package Ccache (compiler cache) Installing zip package Ccache (compiler cache) Installing python virtualenv and ESP-IDF python requirements… Creating a new Python environment in f:\espidf_vs\python_env\idf4.1_py3.6_env … Collecting wheel Downloading https://files.pythonhosted.org/packages/a7/00/3df031b3ecd5444d572141321537080b40 c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl Installing collected packages: wheel Successfully installed wheel-0.35.1 Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored Collecting wheel Downloading https://files.pythonhosted.org/packages/a7/00/3df031b3ecd5444d572141321537080b40 c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl Installing collected packages: wheel Successfully installed wheel-0.35.1 Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored Processing \${idf_path}\tools\kconfig_new\esp-windows-curses Exception: Traceback (most recent call last): File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\basecommand.py”, line 215, in main status = self.run(options, args) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\commands\install.py”, line 335, in run wb.build(autobuilding=True) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\wheel.py”, line 749, in build self.requirement_set.prepare_files(self.finder) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 620, in prepare_file session=self.session, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 809, in unpack_url unpack_file_url(link, location, download_dir, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 715, in unpack_file_url unpack_file(from_path, location, content_type, link) File "f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\utils_init.py", line 602, in unpack_file tarfile.is_tarfile(filename) or File “D:\Anaconda\lib\tarfile.py”, line 2447, in is_tarfile t = open(name) File “D:\Anaconda\lib\tarfile.py”, line 1568, in open return func(name, “r”, fileobj, **kwargs) File “D:\Anaconda\lib\tarfile.py”, line 1633, in gzopen fileobj = gzip.GzipFile(name, mode + “b”, compresslevel, fileobj) File “D:\Anaconda\lib\gzip.py”, line 163, in init fileobj = self.myfileobj = builtins.open(filename, mode or ‘rb’) FileNotFoundError: [Errno 2] No such file or directory: ‘\\${IDF_PATH}\tools\kconfig_new\esp-windows-curses’ Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored You are using pip version 9.0.1, however version 20.2.4 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command. Command failed: “f:\espidf_vs\python_env\idf4.1_py3.6_env\Scripts\python.exe” -m pip install -r “f:\espidf_vs\esp-idf-v4.1\requirements.txt” Exception: Traceback (most recent call last): File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\basecommand.py”, line 215, in main
status = self.run(options, args) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\commands\install.py”, line 335, in run wb.build(autobuilding=True) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\wheel.py”, line 749, in build self.requirement_set.prepare_files(self.finder) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 620, in prepare_file session=self.session, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 809, in unpack_url unpack_file_url(link, location, download_dir, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 715, in unpack_file_url unpack_file(from_path, location, content_type, link) File "f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\utils_init.py", line 602, in unpack_file tarfile.is_tarfile(filename) or File “D:\Anaconda\lib\tarfile.py”, line 2447, in is_tarfile t = open(name) File “D:\Anaconda\lib\tarfile.py”, line 1568, in open return func(name, “r”, fileobj, **kwargs) File “D:\Anaconda\lib\tarfile.py”, line 1633, in gzopen fileobj = gzip.GzipFile(name, mode + “b”, compresslevel, fileobj) File “D:\Anaconda\lib\gzip.py”, line 163, in init fileobj = self.myfileobj = builtins.open(filename, mode or ‘rb’) FileNotFoundError: [Errno 2] No such file or directory: ‘\\${IDF_PATH}\tools\kconfig_new\esp-windows-curses’ Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored You are using pip version 9.0.1, however version 20.2.4 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command. Command failed: “f:\espidf_vs\python_env\idf4.1_py3.6_env\Scripts\python.exe” -m pip install -r “f:\espidf_vs\esp-idf-v4.1\requirements.txt” Exception: Traceback (most recent call last): File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\basecommand.py”, line 215, in main status = self.run(options, args) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\commands\install.py”, line 335, in run wb.build(autobuilding=True) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\wheel.py”, line 749, in build self.requirement_set.prepare_files(self.finder) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\req\req_set.py”, line 620, in prepare_file session=self.session, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 809, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes) File “f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\download.py”, line 715, in unpack_file_url unpack_file(from_path, location, content_type, link) File "f:\espidf_vs\python_env\idf4.1_py3.6_env\lib\site- packages\pip\utils_init.py", line 602, in unpack_file tarfile.is_tarfile(filename) or File “D:\Anaconda\lib\tarfile.py”, line 2447, in is_tarfile t = open(name) File “D:\Anaconda\lib\tarfile.py”, line 1568, in open return func(name, “r”, fileobj, **kwargs) File “D:\Anaconda\lib\tarfile.py”, line 1633, in gzopen fileobj = gzip.GzipFile(name, mode + “b”, compresslevel, fileobj) File “D:\Anaconda\lib\gzip.py”, line 163, in init fileobj = self.myfileobj = builtins.open(filename, mode or ‘rb’) FileNotFoundError: [Errno 2] No such file or directory: ‘\\${IDF_PATH}\tools\kconfig_new\esp-windows-curses’ Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored You are using pip version 9.0.1, however version 20.2.4 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command. The following paths should be added to env PATH .;D:\Anaconda;f:\espidf_vs\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32- elf\bin;f:\espidf_vs\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2- elf\bin;f:\espidf_vs\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf- binutils\bin;f:\espidf_vs\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp- elf-binutils\bin;f:\espidf_vs\tools\cmake\3.13.4\bin;f:\espidf_vs\tools\openocd- esp32\v0.10.0-esp32-20191114\openocd- esp32\bin;f:\espidf_vs\tools\ninja\1.9.0;f:\espidf_vs\tools\idf- exe\1.0.1;f:\espidf_vs\tools\ccache\3.7
以上报错信息原因可能在于Python版本或者无Python全局路径错误-------当前错误解决方法:切换为
Python3.7以上版本问题解决;另外最好运行win+R,输入cmd进入命令行,输入python检查当前PC的python工具链是否已经加入系统变量,无则在系统变量PATH加xxx:\Python&xxx:\Python\Scripts,假如弹出win商店可参考以下该问题解决方法:
输入python打开windows store: 原因在于环境变量“C:\Users\xxx\AppData\Local\Microsoft\WindowsApps”的优先级高于python 环境变量优先级 解决办法: 1.删除windows应用商店环境变量 2.将Python的环境变量放在前面 输入python依然打开windows store: 记得重新打开终端测试
下载完毕,Python提示requirements has been installed,提示可前往’Go to next step’下一步进行工具链验证
默认参数是配置好的,只需点击验证:
成功安装界面:
以下为ESP-IDF编译工程步骤: 一. 点击上述’View ESP-IDF project examples’ 或者 Shift+ctrl+P - 在上述弹出框输入 ESP-IDF:展示
二.选择其中一个工程,然后点击‘Create project using example blink’,选择工程文件生成目录
1.串口选择 2.工程配置,类似Ubuntu idf.py menuconfig配置界面,配置下载&串口波特率等 3.编译 4.下载 5.串口选择 6.一键编译&下载
一. 首先点击编译3:点击终端-选择‘显示正在运行的任务’,即可显示编译信息。
二. 随后点击工程配置选项2:搜索baud 找到波特率配置选项,调试串口‘Serial flasher config’不需要修改,Common ESP-related下载波特率可修改为官方默认支持’921600’,提升下载速率。点击保存。
三.插入目标板,点击串口选择1,在面板上栏弹出串口列表,选中对应串口号。
四.点击下载4,即可烧录程序进入目标机
五.打开串口5,观察调试信息。
转载:https://blog.csdn.net/ami82/article/details/110382425