ESP32 ubuntu1804 コンパイル環境構築

0、ubuntu1804環境のインストールは主にesp-idf(SDK)のインストールです 

     設置上の注意事項:

            マスターの代わりに esp-idf バージョンを選択します。最新のリリース バージョンを選択することをお勧めします。

            ubuntu ソースが遅い場合は、Tsinghua ソースに置き換えることをお勧めします

            esp-idf のバージョンが混在している場合、コンパイルは失敗します。削除してやり直してください。

   ubuntu のデフォルトのソースは非常に遅いため、進行状況バーを待つのは人生の無駄です。

cp /etc/apt/sources.list   /etc/apt/sources.list-bak

vim   /etc/apt/sources.list 




######################################################################
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
######################################################################

apt update
apt upgrade

1. esp-idf をダウンロードします(gitee または github のソースを使用できます) <リリースバージョンを選択してみてください!> <最後のものは寝返りがとても簡単です>

esp-idf のリリース v4.2 バージョンを選択します

git clone -b v4.2 --recursive  https://gitee.com/EspressifSystems/esp-idf.git
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git
 

2. コンポーネントコンポーネントをダウンロードします。

 

cd esp-idf

../esp-gitee-tools/submodule-update.sh

3.SDKのインストール

cd esp-idf

git log

./install.sh 

********************************************************************

(如果出现bidict>=0.21.0t版本不对的问题,可以换成pyhton3 方法如下)

vim tools/idf_tools.py

--   1         #!/usr/bin/env python
++   1         #!/usr/bin/env python3

./install.sh

出现/usr/bin/python3 No Module named pip


sudo apt install python3-pip

./install.sh



********************************************************************

環境変数のエイリアスを追加する

vi ~/.bashrc 

alias get_idf='. /home/airgens/workspace/esp32_workspace/esp-code/esp-idf/export.sh'

ソース ~/.bashrc

 

4. サンプルのコンパイル -> hello world

cd examples/get-started/hello_world/

###############   esp32也有可能是其它target   ##########
idf.py set-target esp32


idf.py menuconfig


idf.py build

正常にコンパイルされました

 

 

5. ボードにダウンロードする

仮想マシンの右下隅でシリアル ポートが認識されます。

ls /dev/ttyUSB0    

sudo chmod 777 /dev/ttyUSB0 

idf.py -p /dev/ttyUSB0 flash
#您可使用快捷键 Ctrl+],退出 IDF 监视器。
idf.py -p /dev/ttyUSB0 monitor
esptools -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32  write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello-world.bin

正常にダウンロードできました

しかし、idf.py -p /dev/USB0 -b 460800 flash コマンドを使用してダウンロードに失敗しました

Pythonのバージョンが原因だと思われます。

 idf.shを修正します  

vim   ../../../esp-idf/idf.py

-- 1   #!/usr/bin/env python
++ 1   #!/usr/bin/env python3

保存
idf.py -p /dev/USB0 -b 460800 flash

 

成功

idf.py -p /dev/ttyUSB0 -b 460800 flash monitor

#ショートカット キー Ctrl+] を使用して IDF モニターを終了できます。

 

 

 

   

おすすめ

転載: blog.csdn.net/wfjdemmye/article/details/113012141