?一、提前說明
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