[ESP32]Win系统vscode集成idf4.1开发esp32项目

Win系统vscode集成idf4.1开发esp32项目

下载安装idf4.1

需要先安装git,然后通过git clone官方的代码:

git clone https://github.com/espressif/esp-idf.git

或是直接下载官方的sdk,目前提供的是v4.0
https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v4.0.zip
如果需要更新到最新的代码,可以直接git pull

git pull

切换idf的代码版本:

git checkout -b xxxx v4.1-dev
git checkout -b v4.1 origin/release/v4.1
git submodule update --init --recursive

下载完成之后,运行IDF里面的install.bat脚本,它会检查安装编译工具链,和python的依赖库。最好打开cmd终端,然后在这里面运行,不然直接运行出错的话,会直接关掉,看不到提示信息。
在这里插入图片描述
这个会从github上面下载指定版本的工具,会比较慢,大家还是需要自己去网上搜索下载。
安装完成之后,可以运行export.bat脚本设置编译环境,然后再去编译一下hello,看能不能正常:

export.bat
cd examples\get-started\hello_world
idf.py build

安装配置vs code

安装vscode.
安装espressif idf插件,搜索“IDF”,可以看到该插件。
在这里插入图片描述
配置idf
在这里插入图片描述
配置python路径,这里需要注意,不要选中系统的python,需要选择.espressif里面的python,因为安装的包是在这个环境里面的

C:\Users\Administrator.espressif\python_env\idf4.2_py3.7_env\Scripts\python.exe

在这里插入图片描述
配置idf路径:
在这里插入图片描述
配置编译工具路径:
在这里插入图片描述
在这里插入图片描述
编译工具( | xtensa-esp32-elf | xtensa-esp32s2-elf | esp32ulp-elf | esp32s2ulp-elf | cmake | openocd-esp32 | ninja | idf-exe | ccache |)路径,它会解压到用户路径里面,大家可以自己去复制,每个文件夹用“;”隔开:

C:\Users\Administrator\.espressif\tools\ccache\3.7;C:\Users\Administrator\.espressif\tools\cmake\3.13.4\bin;C:\Users\Administrator\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;C:\Users\Administrator\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin;C:\Users\Administrator\.espressif\tools\idf-exe\1.0.1;C:\Users\Administrator\.espressif\tools\ninja\1.9.0;C:\Users\Administrator\.espressif\tools\openocd-esp32\v0.10.0-esp32-20191114\openocd-esp32\bin;C:\Users\Administrator\.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin;C:\Users\Administrator\.espressif\tools\xtensa-esp32s2-elf\esp-2019r2-8.2.0\xtensa-esp32s2-elf\bin

opencd scripts路径大概是这个,若不一样,请自行查看:

C:\Users\Administrator\.espressif\tools\openocd-esp32\v0.10.0-esp32-20191114\openocd-esp32\share\openocd\scripts

检测:
在这里插入图片描述
配置完成:
在这里插入图片描述
可以通过examples创建工程。在这里插入图片描述
编译,直接按F1,再输入esp可以看到相应的编译和下载选项:
在这里插入图片描述
下载之前需要先选一个串口!
在这里插入图片描述
不懂什么因,每次打开vscode,如果不走一次上面的配置流程,就会出错,没有办法,把python都用绝对路径算了。
打开“file->preferences->settings”,输入“idf”过滤
把下面的python都替换为:

C:\Users\Administrator.espressif\python_env\idf4.2_py3.7_env\Scripts\python.exe

在这里插入图片描述
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值