0, ubuntu1804 environment installation is mainly the installation of esp-idf (SDK)
Installation Precautions:
Choose the esp-idf version instead of master, it is better to choose the latest release version
If the ubuntu source is slow, it is recommended to replace it with Tsinghua source
If the esp-idf versions are mixed, the compilation will fail, please delete and start again
The default source of ubuntu is extremely slow, waiting for the progress bar is a waste of life.
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. Download esp-idf (you can use the source of gitee or github) <Try to choose the release version! > <lastest is really easy to roll over>
Select the release v4.2 version of esp-idf
git clone -b v4.2 --recursive https://gitee.com/EspressifSystems/esp-idf.git
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git
2. Download the components component
cd esp-idf
../esp-gitee-tools/submodule-update.sh
3. Install 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
********************************************************************
Add an environment variable alias
vi ~/.bashrc
alias get_idf='. /home/airgens/workspace/esp32_workspace/esp-code/esp-idf/export.sh'
source ~/.bashrc
4. Compile sample->hello world
cd examples/get-started/hello_world/
############### esp32也有可能是其它target ##########
idf.py set-target esp32
idf.py menuconfig
idf.py build
compile successfully
5. Download to the board
In the lower right corner of the virtual machine, the serial port is recognized
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
Can be downloaded successfully
But using idf.py -p /dev/USB0 -b 460800 flash command to download failed
Guess it should be due to the version of python.
We modify 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
success
idf.py -p /dev/ttyUSB0 -b 460800 flash monitor
#You can use the shortcut key Ctrl+] to exit the IDF monitor.