ESP32 esp-idf linux最快环境配置,使用自定义环境配置文件。

需求

我们在开发esp32系列的wifi模组时,官方的说明比较繁杂,且服务器github在国外速度慢死,但实际上都是可以解决的,只是找不到要点。
在这里我把最近调试的流程写成脚本文件,这样,以后在使用的时候只需要按部就班,执行几个shell脚本就可以完成环境搭建。

第一步 选择linux虚拟机

这里选择ubuntu18.04.5 感觉对比20.04 和 16.04 要好用些。
安装好后,换上阿里云的源(这里自行百度)后。我们下载些基本工具。

sudo apt update
sudo apt install git open-vm-tools-desktop
reboot

这样准备工作完成

第二步 下载esp-idf和esp-gitee-tools包

国外的可以直接用GitHub的下载(这里不介绍)。
主要说国内的,为了解决慢的问题,官方在gitee上有更新同样的包。官方的gitee地址给出如需

https://gitee.com/EspressifSystems

我们使用git下载,命令如下

#三行不要少了
cd ~
git clone https://gitee.com/EspressifSystems/esp-idf.git
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git

第四步 配置环境

将环境一步配置到位使用如下命令,命令含义不需要深究。

sudo apt install git python python3 python3-pip python-pip cmake ninja-build
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple
pip config set global.trusted-host mirrors.aliyun.com
cp ~/esp-gitee-tools/submodule-update.sh ~/esp-idf/submodule-update.sh
rm ~/esp-idf/install.sh
cp ~/esp-gitee-tools/install.sh ~/esp-idf/install.sh
~/esp-idf/submodule-update.sh ~/esp-idf
~/esp-idf/install.sh ~/esp-idf

如果正常执行完成,那么恭喜你环境配置成功了。

第五步 编译 下载 monitor

拷贝例子

我们需要吧具体的example 从esp-idf包中拷贝出来,类似如下;

cd ~
cp ~/esp-idf/examples examples
编译
cd ./examples/get-started/hello_world
. ~/esp-idf/export.sh
idf.py set-target esp32c3
idf.py app
下载
cd ./examples/get-started/hello_world
. ~/esp-idf/export.sh
idf.py -p /dev/ttyUSB0 flash
monitor
cd ./examples/get-started/hello_world
. ~/esp-idf/export.sh
idf.py -p /dev/ttyUSB0 monitor

第五步 vscode 插件配置

按照提示安装所需的组件,记得是 sudo apt install git cmake ninja-build .
然后选择如下配置,点击install即可。(如有不足留言指正)
在这里插入图片描述

最后重点给六下几个脚本:依次运行即可配置完成环境

idf_packet_download.sh
idf_envirment.sh
build.sh(请拷贝到例子的目录执行)

地址如下
https://download.csdn.net/download/qq_42074368/20067391

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值