小明分享|基于VSCode Espress IDF软件环境搭建
VS code下載網(wǎng)址: ——現(xiàn)版本安裝包大小大約60M左右,是一個(gè)輕量級(jí)但功能強(qiáng)大的源代碼編輯器,適用于Windows、macOS和Linux。支持安裝擴(kuò)展各類應(yīng)用插件。
https://code.visualstudio.com/docs/?dv=win
需以管理員模式運(yùn)行VS code(Python下載文件時(shí)可能會(huì)出現(xiàn)以下錯(cuò)誤:Cache entry deserialization
failed, entry ignored)
下載espress IDF插件:
下載完插件后,按下Ctrl+Shift+p輸入: espidf configure extension,回車,即可進(jìn)行IDF插件的配置界面
以上提示: 1. 需要提前裝好Git與Python應(yīng)用(如果你的電腦已經(jīng)安裝過git或者Python則不用重新安裝,
VScode會(huì)自動(dòng)找到用戶軟件安裝路徑,前提你沒有安裝后修改軟件目錄)
2. 是否每次開機(jī)時(shí)打開這個(gè)畫面
3. 配置保存在哪里
其中Python版本要求:Python 3.7+,Git無版本限制,安裝Python時(shí)記得勾選生效全局變量文件,忘
記勾選也可以在全局變量PATH中新增:
Python\Python39\ Python\Python39\Scripts,這兩項(xiàng)。
隨后點(diǎn)擊START,即可進(jìn)行工具鏈目錄配置,當(dāng)然前提是你的PC端已經(jīng)安裝好Git/Python,及ESP_IDF依賴包進(jìn)入Python路徑選擇界面,之前我下載過其他版本的Python,VScode將安裝的路徑都一一羅列,可以到‘我的電腦’查看是否存在該路徑并確認(rèn)Python版本號(hào)。
這里我選擇了D盤的Python3.6.4版本(錯(cuò)誤示范),選擇完畢,點(diǎn)擊配置ESP-IDF。
隨后進(jìn)入的是ESP-IDF依賴包工具配置界面,此處的配置有兩種方法:
一. 在線下載,選擇你所要安裝的版本,選擇下載目錄,隨后點(diǎn)擊‘Click here to download’即可開始下
載安裝,不過由于是外網(wǎng)下載可能很慢,所以以下提供ESP-IDF百度云鏈接,可以通過方法二進(jìn)行配置安裝。
二. 離線下載,選擇‘在系統(tǒng)中查詢ESP-IDF版本’,隨后找到全部解壓后的ESP-IDF路徑中的esp-idf v4.1文件夾,最后點(diǎn)擊‘Click here to check if is valid’驗(yàn)證路徑中是否存在ESP-IDF。
驗(yàn)證成功將出現(xiàn)路徑的版本信息與idf.py工具存在。最后點(diǎn)擊’ESP-IDP Tools setup’,進(jìn)行ESP-IDF工具依賴安裝。
此處無論你是使用離線下載或者在線下載的方式,都需要選擇’Download ESP-IDF Tools’。另一個(gè)選項(xiàng)為跳過安裝直接進(jìn)入工具鏈環(huán)境安裝驗(yàn)證。
如果你是離線下載好的工具鏈則選擇工具鏈文件夾的上一級(jí)目錄,但注意不要選擇工具鏈文件夾內(nèi),它的下載規(guī)則是在指定目錄新建文件夾并下載工具鏈,如果已經(jīng)存在對(duì)應(yīng)文件就將跳過下載。如果你是在線下載的只需選擇下載路徑,點(diǎn)擊Download,接下來只需等待下載安裝。
解析到對(duì)應(yīng)下載文件后,其會(huì)把對(duì)應(yīng)壓縮包解壓安裝,接下來進(jìn)行等待工具鏈安裝完畢即可。
此處可能會(huì)要求你進(jìn)行環(huán)境變量添加,此處還沒驗(yàn)證不添加有何錯(cuò)誤:
工具鏈安裝編譯日志:
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
以上報(bào)錯(cuò)信息原因可能在于Python版本或者無Python全局路徑錯(cuò)誤-------當(dāng)前錯(cuò)誤解決方法:切換為
Python3.7以上版本問題解決;另外最好運(yùn)行win+R,輸入cmd進(jìn)入命令行,輸入python檢查當(dāng)前PC的python工具鏈?zhǔn)欠褚呀?jīng)加入系統(tǒng)變量,無則在系統(tǒng)變量PATH加xxx:\Python&xxx:\Python\Scripts,假如彈出win商店可參考以下該問題解決方法:
輸入python打開windows store: 原因在于環(huán)境變量“C:\Users\xxx\AppData\Local\Microsoft\WindowsApps”的優(yōu)先級(jí)高于python 環(huán)境變量?jī)?yōu)先級(jí) 解決辦法: 1.刪除windows應(yīng)用商店環(huán)境變量 2.將Python的環(huán)境變量放在前面 輸入python依然打開windows store: 記得重新打開終端測(cè)試
下載完畢,Python提示requirements has been installed,提示可前往’Go to next step’下一步進(jìn)行工具鏈驗(yàn)證
默認(rèn)參數(shù)是配置好的,只需點(diǎn)擊驗(yàn)證:
成功安裝界面:
以下為ESP-IDF編譯工程步驟: 一. 點(diǎn)擊上述’View ESP-IDF project examples’ 或者 Shift+ctrl+P - 在上述彈出框輸入 ESP-IDF:展示
二.選擇其中一個(gè)工程,然后點(diǎn)擊‘Create project using example blink’,選擇工程文件生成目錄
1.串口選擇 2.工程配置,類似Ubuntu idf.py menuconfig配置界面,配置下載&串口波特率等 3.編譯 4.下載 5.串口選擇 6.一鍵編譯&下載
一. 首先點(diǎn)擊編譯3:點(diǎn)擊終端-選擇‘顯示正在運(yùn)行的任務(wù)’,即可顯示編譯信息。
二. 隨后點(diǎn)擊工程配置選項(xiàng)2:搜索baud 找到波特率配置選項(xiàng),調(diào)試串口‘Serial flasher config’不需要修改,Common ESP-related下載波特率可修改為官方默認(rèn)支持’921600’,提升下載速率。點(diǎn)擊保存。
三.插入目標(biāo)板,點(diǎn)擊串口選擇1,在面板上欄彈出串口列表,選中對(duì)應(yīng)串口號(hào)。
四.點(diǎn)擊下載4,即可燒錄程序進(jìn)入目標(biāo)機(jī)
五.打開串口5,觀察調(diào)試信息。
總結(jié)
以上是生活随笔為你收集整理的小明分享|基于VSCode Espress IDF软件环境搭建的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ESP32在Ubuntu16.04的环境
- 下一篇: 小明分享|ESP32-C3到底有哪些不一