ESP32-Linux开发环境配置说明
环境配置
1. 安装管理包
//换源
1.打开apt源文件
sudo vi /etc/apt/sources.list
2.将里面内容替换为如下内容并保存
#阿里源 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse #清华源 deb 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 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
3. 安装相关包
sudo apt-get install vim git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing
2. 安装IDF/ADF
cd /home/alfred/esp/esp-adf/esp-idf
./install.sh
3. 配置系统环境变量
//打开profile
sudo vi /etc/profile
//添加如下内容
alias get_idf='. $HOME/esp/esp-idf/export.sh'
export ADF_PATH=~/esp/esp-adf
//验证路径配置:(printenv ADF_PATH)
4. 声明系统环境变量
source /etc/profile
5. 运行相关声明出来的脚本
get_idf
6. 配置串口权限(插上开发板串口)
sudo chmod 0777 /dev/ttyUSB0
7. 查看系统配置(这步可以省略,需要的时候再配置)
idf.py menuconfig
编译工程
1.拷贝相关工程到自己工作区
//adf example
cp -r ~/esp/esp-adf/example/get_started/blink ~/WorkStation
//adf下的idf example
cp -r ~/esp/esp-adf/esp-idf/example/get_started/blink ~/WorkStation
//idf下example
cp -r ~/esp/esp-idf/example/get_started/blink ~/WorkStation
2. 打开工作区build工程
idf.py build
3. 下载固件到板子上
//下载固件到板子(需要手动按住板子上的BOOT,再按住RST,松开RST,再松开BOOT,进入下载模式)
idf.py -p /dev/ttyUSB0 flash
//自动下载固件到板子(前期不建议,麻烦,开发完成之后再这样下载)
esptool.py write_flash 0x0 factory.bin
esptool.py erase_flash
最后附上网盘链接
链接: https://pan.baidu.com/s/1w77k18_0QGyjITdICQGCAw 密码: 9q83
–来自百度网盘超级会员V6的分享