VS Code+ESP IDF开发环境搭建


前言

折腾了两天终于把开发环境搭好了


一、安装VS Code

这个默认都会,略

二、安装ESP-IDF

2.1安装Espressif IDF

在VS Code扩展商店中搜索Espressif IDF
在这里插入图片描述
直接安装

2.2安装Python

安装完成后,到这里停一下,安装Python,记得Python换源,命令如下:

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
//永久换源,在命令提示符中运行

显示如下为成功:
在这里插入图片描述

2.3配置 ESP-IDF 插件

接下来按下 F1 或 Ctrl+Shift+P 打开命令行,输入 esp-idf extension,并点击“配置 ESP-IDF 插件”打开如下界面:
在这里插入图片描述
select where to save these settings中选择Global,然后选择EXPRESS点击,进入如下界面:
在这里插入图片描述Enter ESP-IDF container directory这里选择安装文件夹注意文件夹名字不要有空格

Enter ESP-IDF Tools directory (IDF_TOOLS_PATH)这里的文件夹不要有空格并且改文件夹要为空的

其他和上面图片一样就行,然后点击install开始安装,等待十几二十分钟即可。

安装成功会显示如下界面:
在这里插入图片描述

三、安装CP2102驱动

最简单的就是打开驱动精灵一键安装
网上的办法用了一遍,没有一个成功的。可能我电脑不太行。

四、波特率设置

需打开 VS Code 的设置面板,输入 esp-idf,将波特率改为 115200 后即可。

五、测试是否安装成功

ctrl+p输入

>ESP-IDF: Show Examples Projects


选择hello_world,然后编译。

六、关于安装和使用时的报错

6.1配置 ESP-IDF 插件卡在最后一步

一般是卡在Python那里,换源即可

6.2vscode can’t open file ‘d:\ESP32\Arduino’

vscode can’t open file 'd:\ESP32\Arduino’在这个路径是ESP-IDF container directory的安装路径时,那就是这个文件夹有空格,这个错误后面会跟着终端进程“C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe。

6.3无法写入用户设置。请打开用户设置并清除错误或警告,然后重试。

这个是VSCode的设置文件里面有报错,检查一下settings.json文件是否有红色波浪线啥的,是不是少了逗号,括号啥的等等

6.4使用例程无限重启

这次遇到的是CONFIG_FREERTOS_UNICORE没有使能,单核的芯片用的双核的配置

6.5idf.py 报错

这个解决方法没找到,另外最新版生成的例程文件夹中也没有idf.py这个文件,应该是没有吧,我测试中有一次是可以用的,后面怎么试都不能用。

6.6运行时报错

E (190) cpu_start: Running on single core variant of a chip, but app is built with multi-core support.
E (196) cpu_start: Check that CONFIG_FREERTOS_UNICORE is enabled in menuconfig

使用的芯片只有单核,所以打开sdkconfig把CONFIG_FREERTOS_UNICORE=y写进去就行了,注意这句不能有空格

6.7每十秒重启一次

这个不是报错,是程序里写的。

### ESP-IDF Framework Installation Guide #### Installing ESP-IDF on Windows The ESP-IDF essentially contains APIs for ESP32 and scripts to operate the toolchain[^1]. For a successful setup, follow this structured approach: To begin installing ESP-IDF on Windows, download the official installer from Espressif’s website. Once downloaded, execute the installer file. During installation, ensure selecting options that allow automatic configuration of necessary environment variables such as `Path`. This ensures accessibility of required tools system-wide without additional configurations[^2]. If not configured automatically during installation or if manual adjustments are preferred, manually add paths pointing to directories containing essential binaries like GCC compiler suite, OpenOCD debugger software, Python scripts directory among others into the system's environmental variables list. After completing the above steps, proceed with installing CMake which is crucial for building projects within the ESP-IDF ecosystem. For verification purposes after installation completes successfully, open Command Prompt (cmd.exe), enter commands corresponding to each installed component; they should respond appropriately indicating proper functioning post-installation. ```bash cmake --version gcc --version openocd --version ``` Ensure all components display their respective version information correctly when executed via command line interface. #### Configuring Development Environment Post-Installation Post-installation involves setting up development environments tailored towards working efficiently with ESP32 microcontrollers through ESP-IDF SDK provided interfaces & utilities. Verify installation success by creating sample applications utilizing templates available under examples folder present inside esp-idf root directory structure. Use menuconfig utility accessible either directly from terminal/command prompt or integrated IDEs supporting ESP-IDF project management features for configuring application parameters before compilation process begins. Compile created/modified source codes targeting selected board models supported natively out-of-box alongside custom ones defined according to specific requirements documents supplied separately outside scope hereof. Flash compiled firmware images onto target hardware devices over USB connection established between host computer running build systems described earlier sections hereinabove mentioned paragraphs covering entire workflow cycle starting initial preparations ending final deployment stages ready execution runtime contexts hosted onboard chosen evaluation platforms specifically designed around ESP series SoCs manufactured marketed sold worldwide commercially off-the-shelf products readily procurable purchase orders placed direct suppliers authorized distributors channels retail outlets online marketplaces etcetera ad infinitum.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值