idf.py的使用
idf.py的使用流程和命令:
cd C:\work\esp_projects\
idf.py create-project pwm_led
cd pwm_led
idf.py set-target esp32s2
idf.py menuconfig
编写自己的 app_main() 函数
idf.py build
https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/tools/idf-py.html
如果我们在网上下载了一个components,例如esp32-camera:
放置位置保持如下目录结构:
your_project/
├── CMakeLists.txt
├── main/
│ └── main.c
└── components/
└── esp32-camera/
├── CMakeLists.txt
├── Kconfig
├── driver/
│ ├── camera.c
│ └── camera.h
└── ...
放完后,再做一次 idf.py set-target esp32s2 ,否则可能找不到这个组件:
工程顶层 CMakeLists 不需要特别改
ESP-IDF 会自动扫描 components/ 下的目录,只要目录里有 CMakeLists.txt,它就会注册成组件。
Kconfig(可选)
有些第三方组件会提供 Kconfig 文件,这样你能在 idf.py menuconfig 里看到配置项。
如果缺少 Kconfig,编译也能过,只是不能在 menuconfig 里设置选项。

浙公网安备 33010602011771号