Ubuntu18.04 上通过 jihu 镜像完成 ESP-IDF 编译环境搭建流程

为了解决国内开发者从 github 克隆 esp 相关仓库慢的问题,已将 esp-idf 和部分重要仓库及其关联的子模块镜像到了 jihu,这些仓库将自动从原始仓库进行同步。此篇博客用来阐述 Ubuntu18.04 上通过 jihu 镜像完成 ESP-IDF 编译环境搭建流程。

注:乐鑫对应的 jihu 镜像仓库为 esp-mirror espressif 仓库

1 环境搭建前提

1.1 安装编译 ESP-IDF 需要的软件包:
bash 复制代码
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util
1.2 安装 Python 3.8
bash 复制代码
sudo apt-get install python3.8-venv python3.8-dev
1.3 选择 python3 环境:
bash 复制代码
sudo update-alternatives --config python
1.4 安装 install pip

使用 pip 安装以下 python 软件包

bash 复制代码
python -m pip install pyyaml xlrd

python -m pip --version
1.5 安装 curses
bash 复制代码
sudo apt-get install libncurses5-dev

2 创建一个空的文件夹来存放 esp-idf SDK 和设置 jihu 镜像环境所需的 esp-gitee-tools 工具

bash 复制代码
cd esp

mkdir jihu

cd jihu

3 克隆 esp-gitee-tools 工具

bash 复制代码
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git

4 运行 jihu-mirror.sh 脚本,设置 jihu 镜像环境

c 复制代码
./jihu-mirror.sh set

运行此指令后,以后克隆任意 Github espressifesp-mirror espressif 下的仓库和组件都会自动镜像 URL 链接到 jihu 链接上。例如:


当我们使用命令 git clone https://github.com/espressif/esp-idf 时,默认的 URL https://github.com/espressif/esp-idf 将被自动替换成 https://jihulab.com/esp-mirror/espressif/esp-idf

当然,也可以使用如下恢复命令,取消已经设置的 jihu 镜像环境,从而不使用镜像的 URL。

bash 复制代码
./jihu-mirror.sh unset

5 通过 jihu 镜像环境克隆 esp-idf

bash 复制代码
cd ..
cd jihu
git clone -b v5.1.1 https://jihulab.com/esp-mirror/espressif/esp-idf.git

可以直接在esp-mirror espressif 下获取仓库链接,也可以直接使用 Github espressif 下的仓库链接。

6 更新 esp-idf 子仓库

bash 复制代码
cd esp-idf                                              

git submodule update --init --recursive

7 设置 esp-idf 的环境变量和运行 esp-idf 工具链

bash 复制代码
export IDF_PATH=$(pwd)

./install.sh 

. ./export.sh

8 编译 esp-idf 下的工程

bash 复制代码
cd examples/get-started/hello_world

idf.py set-target esp32s3           //选择 esp32s3 的芯片环境

idf.py menuconfig                  

idf.py build

idf.py flash monitor
相关推荐
Caroline皮皮8 小时前
团队开发中的Git 文件名大小写不敏感导致的文件冲突
git
9ilk9 小时前
【Git】--- 多人协作实战场景
git
lllsure12 小时前
Git使用与管理
git
座山雕~13 小时前
Maven超级详细安装部署
git·github·maven
GanGuaGua14 小时前
linux系统下如何提交git和调试
服务器·git
csj501 天前
git分支合并信息查看
git
gqkmiss1 天前
Git Cherry-pick:核心命令、实践详解
前端·git·前端框架·commit·cherry-pick
小生不才yz1 天前
15. git push
git
阿虎儿1 天前
基于三方开源项目二次开发的版本管理最佳实践
git
曼陀罗1 天前
【Git篇】commit失败后,展示: stash@{0}WIP on Feature_xx:
git