之前三国演义提及超快速搭建开发环境
今天补充若干
知识1
在linux平台的时候
我往往会把下面2个命令放在文本
频繁复制粘贴 略显笨拙
cd esp/esp-idf/examples/bluetooth/bluedroid/ble/gatt_client/
. $HOME/esp/esp-idf/export.sh
这里给一个快捷方式 做一个别名 如下文
导入环境,这一步会将ESP-IDF需要的PATH添加到环境变量中,如果希望下次开机,这些环境变量还存在,可以添加到系统环境变量中~/.bashrc
alias get_idf='. /home/bigmagic/workspace/esp-idf-v4.3-beta3/export.sh'
source ~/.bashrc
每次开启新的窗口,只需要输入get_idf
即可自动进行环境路径的添加
当你在WIN10 点击桌面快捷方式
进来的时候蓝色的powershell 前面的提示就是在自动跑脚本
当你在linux安装完成esp-idf以后
最后的提示跑export.sh脚本 就是在安装环境变量

知识2
/dev/ttyUSB0 failed to connect: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
sudo chmod 777 /dev/ttyUSB0
再走一遍linux流程
【代码】
在/home/roy 执行
git clone --recursive https://github.com/espressif/esp-idf.git
完成以后出现文件夹 /home/roy/esp-idf
【工具链】
cd /home/roy/esp-idf
./install.sh esp32c3
. ./export.sh (帮助你增加环境变量的)
【开始使用】
cd /home/roy/esp-idf/examples/bluetooth/bluedroid/ble/gatt_client
idf.py set-target esp32c3
idf.py flash
idf.py menuconfig
idf.py monitor
简化
idf.py app 只是构建app
idf.py app-flash 只是烧写app
idf.py erase_flash
esptool.py erase_flash
上面在乌班图成功 在Raspberry依旧失败
所以在Raspberry上无法顺利使用ESP-IDF
这是官方的锅
结论在WIN10编译出三兄弟HEX
在PI上用esp-tool烧写
WIN10环境
https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/get-started/index.html#
https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/get-started/windows-setup.html
超级简单
根据上面 行3的链接
下载 离线安装器
他会自动配置好WIN10 然后克隆好GitHub的源码到C盘
完成以后桌面出现3个快捷方式
只需要保留蓝色的powershell即可
需要编译的时候 双击蓝色的powershell
执行cd example/bXX/bXX/bXX
然后使用esp指令就可以编译 烧写 模拟
另外vscode有插件的方式
不需要使用蓝色的powershell
甚至还可以debug
后续在补充
文章评论