樹莓派3B安裝ESP-IDF

1. 樹莓派系統(tǒng)的安裝

?之前嘗試liteOS版本無法正常安裝ESP-IDF,至于什么原因不知道,后重新安裝Legacy 桌面系統(tǒng)可以正常安裝。

系統(tǒng)的安裝,請(qǐng)前往樹莓派官網(wǎng),根據(jù)指定操作步驟進(jìn)行即可。

2.因?yàn)槭切卵b的系統(tǒng),用不著Python2.7的版本,可以在終端使用命令卸載。我是把系統(tǒng)自帶的Python2.7和Python3.7都卸載干凈:

終端輸入:sudo apt-get remove --auto-remove python

終端輸入:sudo apt-get remove --auto-remove python3

3.安裝python3以及相應(yīng)依賴

終端輸入:sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-click python3-pip python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev

為python3創(chuàng)建軟連接

ln -s /etc/bin/python3 /etc/bin/python

4.獲取esp-idf

cd ~/esp

sudo git clone -b v4.0 --recursive https://github.com/espressif/esp-idf.git

沒有翻墻情況下,很難能夠成功克隆下來,試了多個(gè)晚上熬夜,都無法成功

建議使用碼云上的項(xiàng)目克隆下來

https://gitee.com/EspressifSystems/esp-gitee-tools/blob/master/docs/README-submodule-update.md

安裝此處的指引,非??斓目梢园颜麄€(gè)項(xiàng)目完整的克隆下來

cd ~/esp

git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git

git clone??-b v4.0 https://gitee.com/EspressifSystems/esp-idf.git

進(jìn)入esp-gitee-tools文件夾
cd esp-gitee-tools

./submodule-update.sh ../esp-idf

執(zhí)行該腳本,會(huì)將esp-idf項(xiàng)目的所有子模塊一并克隆下來,等待完成

5.下載交叉編譯工具鏈

cd ~/esp?

下載xtensa交叉編譯工具鏈(一定要2019r2-linux-armel才能與esp-idf?v4.0 匹配使用)

sudo wget https://github.com/espressif/crosstool-NG/releases/download/esp-2019r2/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-armel.tar.gz

解壓

sudo tar -xzf xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-armel.tar.gz?

6.設(shè)置環(huán)境變量

sudo vim ~/.bashrc

在文件末添加以下內(nèi)容:

export IDF_PATH=~/esp/esp-idf

export PATH="$HOME/esp/xtensa-esp32-elf/bin:$IDF_PATH/tools:$PATH"

source ~/.bashrc

7.安裝 Python 環(huán)境編譯需要的軟件包

cd ~/esp/esp-idf

python -m pip install --user -r ./requirements.txt

8.連接開發(fā)板

終端運(yùn)行 `lsusb`,檢查開發(fā)板是否連接成功,

終端運(yùn)行 `dmesg`, 獲取端口號(hào): cp210x converter now attached to ttyUSB0 (/dev/ttyUSB0)

8.編譯例程

cd ~/esp

拷貝hello_world至esp目錄下

sudo cp esp-idf/examples/get-started/hello_world/ . -rf

為hello_world添加讀寫權(quán)限

sudo chmod 777 -R hello_world/

cd hello_world

配置

idf.py menuconfig

進(jìn)入menuconfig后,在Serial flasher config菜單設(shè)置串口端口 Flash size設(shè)置為4M

執(zhí)行以下命令編譯

idf.py build

9.燒錄固件

執(zhí)行以下命令編譯

idf.py -p /dev/ttyUSB0 flash

# /dev/ttyUSB0根據(jù)自己的情況填寫

10.監(jiān)視器

執(zhí)行以下命令打開監(jiān)視器

idf.py -p /dev/ttyUSB0 monitor

------------------------------------------------

參考文章

1.https://www.bilibili.com/read/cv5394053/

2.https://gitee.com/EspressifSystems/esp-idf

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容