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
相关推荐
胡西风_foxww11 小时前
git 添加除了包含特定字符串的文件
git·字符串·文件·add·添加·特定·包含
parade岁月12 小时前
Git 凭据管理器原理与多账号管理指南
git
zzzyulin12 小时前
git note
git
六件套是我12 小时前
【解答疑惑】git执行cherrypick后到另一个分支,然后再合并会出现问题吗?
git
sulikey1 天前
从零配置一个规范的 Python Git 仓库(适用于 Gitee / GitHub)
git·python·pycharm·gitee·github
学渣676561 天前
【面向小白】git rebase全面总结,什么时候用rebase
git
小龙报1 天前
《算法每日一题(1)--- 第31场蓝桥算法挑战赛》
c语言·开发语言·c++·git·算法·学习方法
222you1 天前
idea整合Git
git
今禾1 天前
Git完全指南(下篇):Git高级技巧与问题解决
前端·git·github
Molesidy2 天前
【Git】【TortoiseGit】TortoiseGit安装与基础使用
git