下载esp-idf
git clone --recursive https://github.com/espressif/esp-idf.git
设置工具
cd esp-idf
./install.sh
主要配置python工具,可以修改下载源的方式提高下载速度
vim ~/.pip/pip.conf
在pip.conf中添加如下内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
设置环境变量
. ./export.sh
下载esp32-s2-kaluga-1工程代码
git clone --recursive https://github.com/espressif/esp-dev-kits.git
使用esp-idf的hello-world程序,复制hello-world程序到esp-idf同级目录
cp esp-idf/examples/get-started/hello_world . -rf
cd hello_world
配置工程
idf.py set-target esp32s2 menuconfig
注意:第一次配置需要指定主控芯片类型,配置时添加set-target esp32s2,之后对配置修改只需要idf.py menuconfig,否则会导致之前的参数被默认配置覆盖
编译工程
idf.py all
烧录,串口线插上后会有两个物理接口,串口是/dev/ttyUSB1
idf.py -p /dev/ttyUSB1 falsh
日志输出
idf.py -p /dev/ttyUSB1 monitor
使用ctrl+]退出监控模式