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
相关推荐
sduwcgg5 小时前
git经验
git
麻雀无能为力5 小时前
git的使用
git
算法歌者8 小时前
Visual Studio 项目 .gitignore 文件指南
git·visual studio
江边垂钓者8 小时前
git cherry-pick和git stash命令详解
git
Lw老王要学习8 小时前
Linux架构篇、第五章git2.49.0部署与使用
linux·运维·git·云计算·it
爱学习的张哥8 小时前
专栏项目框架介绍
git·fpga开发·udp·ddr·gt收发器
Aric_Jones11 小时前
lua入门语法,包含安装,注释,变量,循环等
java·开发语言·git·elasticsearch·junit·lua
Sapphire~18 小时前
odoo-049 Pycharm 中 git stash 后有pyc 文件,如何删除pyc文件
ide·git·pycharm
Willis_m21 小时前
Linux 服务器用 SSH 拉取多个 Git 工程
linux·服务器·git·ssh
1candobetter21 小时前
git如何将本地 dev 分支与远程 dev 分支同步
git