一、提前说明
1. 系统环境 Ubuntu22.04
2. 适配芯片 ESP32S3
3. idf版本 v5.4.1(截止2025年4月13日为最新版本)
二、安装步骤
1. 安装前置依赖
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
这一步一般不会有问题
2. 获取IDF源码
mkdir -p ~/esp # 在根目录创建用于存储esp-idf资料的目录
cd ~/esp # 进入到创建的目录
git clone -b v5.4.1 --recursive https://github.com/espressif/esp-idf.git # 指定版本克隆esp-idf资料
成功后的目录结构
3. 设置工具
cd ~/esp/esp-idf
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets" # 换到国内服务器
./install.sh # 运行安装脚本
成功后的日志
4. 设置环境变量
# 在需要运行idf环境的地方执行下面的指令
. $HOME/esp/esp-idf/export.sh
操作截图
5. 编译验证
进入hello world的目录,编译hello world项目,如果环境正确,则能正常编译
. $HOME/esp/esp-idf/export.sh # 已经设置环境变量的可以忽略
idf.py build