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.在系统目录下新建esp文件夹,在文件夹内克隆esp-idf
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
./install.sh
. ./export.sh
idf.py --version
如果子模块下载失败,想要继续下载:
cd esp-idf
git submodule update --init --recursive
子模块下载成功后继续./install.sh即可
如果一直下不好请自行准备好魔法工具,有魔法后在终端输入:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
检验是否生效:
curl -I https://www.google.com
返回200/301说明魔法有效,此时一般就解决下载问题了,子模块也可以正常下载。
3.克隆esp-adf,与esp-idf同级目录下,即
~/esp
|——esp-idf
|——esp-adf
克隆,如果没有代理请直接输入下方Gitee的下载
git clone --recursive https://github.com/espressif/esp-adf.git
如果clone因为网速失败,想要继续上次未能成功下载的子模块:
cd esp-adf
git submodule update --init --recursive
如果Github下载还是太慢总是下载失败,使用Gitee:
git clone --recursive https://gitee.com/EspressifSystems/esp-adf.git
下载成功后:
cd esp-adf
./install.sh
. ./export.sh
如果想要更新ESP-ADF:
cd ~/esp/esp-adf
git pull
git submodule update --init --recursive
4.添加环境变量
nano ~/.bashrc
在最后加上:
alias get_idf='. $HOME/esp/esp-idf/export.sh'
alias get_adf='. $HOME/esp/esp-adf/export.sh'
ctrl+X退出,ctrl+O写入,注意$HOME与前面的.中间是有空格的。
.前有空格代表source命令,用于加载环境变量。因为每次打开终端的位置可能会不一样,因此不要写为绝对路径。
保存即可每次启动终端时输入get_idf启动esp-idf,get_adf启动esp-adf。
5.编译和烧录
idf.py build
idf.py flash monitor
如果报错,观察报错原因,如果原因是型号不对:
idf.py set-target esp32s3(此处为自己板子型号)
6.设置
idf.py menuconfig
创建新项目
idf.py create_project xxx(此处为你的项目名)
7.vscode安装esp-idf和c++插件,每次创建后可以ctrl+shift+P搜索到esp-idf configuring,单击,然后就可以ctrl点击函数访问源代码
476

被折叠的 条评论
为什么被折叠?



