当前位置: 代码迷 >> 综合 >> 乐鑫ESP32-C3项目(3)- 环境搭建运行helloworld
  详细解决方案

乐鑫ESP32-C3项目(3)- 环境搭建运行helloworld

热度:15   发布时间:2024-01-16 14:56:20.0


终端结束之后,编译工具相关的环境变量都会失效。下次新开终端时,都要首先导出这些变量。
比如 $IDF_PATH 是指 esp-idf的路径。 
Echo  $IDF_PATH 检查一下这个路径是不是OK的

======增加快捷命令 .bash_profile
alias get_idf='. $HOME/xxxxxx/esp-idf/export.sh'

source ~/.bash_profile

导出环境变量:

get_idf 

Echo  $IDF_PATH检查一下

===== 开始 hello_world ====
复制hello_world代码
1.cp -r $IDF_PATH/examples/get-started/hello_world .
cd hello_world
idf.py set-target esp32c3  #环境变量导出OK,idf.py 就会有自动补齐功能
idf.py menuconfig  #不做也可
idf.py build #编译工程
idf.py -p /dev/tty.wchusbserial1410 flash #烧录到板子上,自动刚开始运行  -b设置波特率 默认115200
idf.py -p /dev/tty.wchusbserial1410 monitor # 监听串口 
ctrl+] 退出监听

Hello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 2MB external flash
Minimum free heap size: 329596 bytes
Restarting in