esp32 linux开发环境安装
注释说明:本环境基于Ubuntu20.4系统
1、安装各种必要的工具
sudo apt-get install git wget flex bison gperf python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 net-tools
2、新建esp32目录
mkdir esp32
cd esp32
3、拉取gitee工具
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git
4、执行gitee工具切换镜像脚本
cd esp-gitee-tools
./jihu-mirror.sh set
5、拉取esp-idf源码
cd ..
git clone --recursive https://github.com/espressif/esp-idf.git
6、切换esp-idf版本分支到v5.2
cd esp-idf
git checkout v5.2
git submodule update --init --recursive
如果提示失败或有错误试下这句:../esp-gitee-tools/submodule-update.sh
7、更换pip源
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple
pip config set global.trusted-host mirrors.aliyun.com
8、安装编译工具
../esp-gitee-tools/install.sh
9、设置环境变量并将环境变量放到.bashrc中
source export.sh
echo "source ~/esp32/esp-idf/export.sh" >> ~/.bashrc
10、下载课程配套源码
cd ~/esp32
git clone --recursive https://gitee.com/vi-iot/esp32-board.git
11、编译
cd esp32-board/helloworld
idf.py build
12、设置USB串口权限
sudo usermod -aG dialout usrname usrname需要换成你的用户名
13、重启
reboot
14、下载程序
idf.py flash
15、串口监听
idf.py monitor
退出:ctrl+]
14、安装esptool工具
pip install esptool
15、清空FLAS
esptool --chip esp32 --port <端口号> erase_flash //把<端口号>替换为实际的端口, 例如COM10
例:esptool --chip esp32 --port COM5 erase_flash
16、固件烧录
esptool --chip esp32 --port <端口号> --baud 460800 write_flash -z 0x1000 <固件文件名称>
例:esptool --chip esp32 --port COM5 --baud 460800 write_flash -z 0x1000 "C:\Users\admin\Downloads\lvgl_display.bin"
17、查看开发板信息(Flash内存大小)
esptool -p COM5 flash_id