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
相关推荐
bad-Lz8 小时前
git代码库管理
大数据·git·elasticsearch
YMGogre9 小时前
GitHub 仓库管理员
git·github
好好学习O(∩_∩)O9 小时前
git快速复习(分支篇)
git
头发那是一根不剩了9 小时前
Git :如何把多次提交的功能分支合并提交到 master,只保留一条提交记录
git
可能是这样吧10 小时前
向已有仓库上传,并单独建分支(使用 Git Bash)
git·bash
帅次11 小时前
系统分析师:软件需求工程的需求定义、需求验证和需求管理
软件工程·软件构建·需求分析·代码规范·设计规范·规格说明书·代码复审
HIT_Weston11 小时前
72、【Ubuntu】【Hugo】搭建私人博客:Git 下载方式对比
linux·git·ubuntu
___波子 Pro Max.11 小时前
LInux cut 提取Git邮箱用户名命令解析
git
Xinstall渠道统计平台11 小时前
如何利用APP渠道统计提升营销效果
java·git·github
Joy T12 小时前
【Git 快速实战】VSCode + Git 环境搭建与全流程指令速通指南
ide·git·vscode