Name Date Size #Lines LOC

..--

.github/H--629561

.gitlab/H--3,2032,402

components/H--5,689,7463,621,130

docs/H--165,543113,169

examples/H--291,189218,336

tools/H--150,374129,735

.codespellrcH A D04-Nov-2024278 54

.editorconfigH A D11-Oct-2022616 3828

.flake8H A D02-Nov-20228.6 KiB166155

.gitignoreH A D26-Sep-20241.6 KiB11285

.gitlab-ci.ymlH A D12-Aug-20241.3 KiB3629

.gitmodulesH A D27-May-20256 KiB153129

.mypy.iniH A D26-Feb-2021985 2719

.pre-commit-config.yamlH A D26-May-20258.8 KiB245233

.pylintrcH A D17-Aug-202321.1 KiB642466

.readthedocs.ymlH A D16-Feb-2024538 2210

.shellcheckrcH A D05-Oct-2023164 64

.vale.iniH A D17-Oct-20233.3 KiB12092

CMakeLists.txtH A D15-Oct-202411.7 KiB292250

COMPATIBILITY.mdH A D11-May-20245 KiB11768

COMPATIBILITY_CN.mdH A D11-May-20245.1 KiB11868

CONTRIBUTING.mdH A D05-May-2022314 73

KconfigH A D07-May-202528.1 KiB682549

LICENSEH A D17-Aug-201611.1 KiB203169

README.mdH A D14-Oct-20249.3 KiB13375

README_CN.mdH A D14-Oct-20249.3 KiB13375

ROADMAP.mdH A D16-Sep-20245.8 KiB12478

ROADMAP_CN.mdH A D26-Sep-20245.5 KiB12378

SECURITY.mdH A D11-May-2023532 105

SUPPORT_POLICY.mdH A D12-May-20223.6 KiB5936

SUPPORT_POLICY_CN.mdH A D12-May-20223.3 KiB5936

add_path.shH A D11-Nov-2020721 1910

conftest.pyH A D30-Apr-202517.9 KiB517383

export.batH A D06-Jan-20252 KiB7663

export.fishH A D06-Jan-2025966 3023

export.ps1H A D06-Jan-2025864 2815

export.shH A D06-Jan-20252.2 KiB7051

install.batH A D06-Jan-20252.2 KiB7661

install.fishH A D06-Jan-20251 KiB3825

install.ps1H A D06-Jan-20251.5 KiB3923

install.shH A D06-Jan-20251 KiB4229

pytest.iniH A D10-May-2024955 3630

sdkconfig.renameH A D06-Jun-20232 KiB2826

sgconfig.ymlH A D10-Apr-202432 32

sonar-project.propertiesH A D17-Aug-2023530 2518

README.md

1# Espressif IoT Development Framework
2
3* [中文版](./README_CN.md)
4
5ESP-IDF is the development framework for Espressif SoCs supported on Windows, Linux and macOS.
6
7# ESP-IDF Release Support Schedule
8
9![Support Schedule](https://dl.espressif.com/dl/esp-idf/support-periods.svg?v=1)
10
11- Please read [the support policy](SUPPORT_POLICY.md) and [the documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html) for more information about ESP-IDF versions.
12- Please see the [End-of-Life Advisories](https://www.espressif.com/en/support/documents/advisories?keys=&field_type_of_advisory_tid%5B%5D=817) for information about ESP-IDF releases with discontinued support.
13
14# ESP-IDF Release and SoC Compatibility
15
16The following table shows ESP-IDF support of Espressif SoCs where ![alt text][preview] and ![alt text][supported] denote preview status and support, respectively. The preview support is usually limited in time and intended for beta versions of chips. Please use an ESP-IDF release where the desired SoC is already supported.
17
18|Chip         |          v5.0          |         v5.1           |         v5.2           |         v5.3           |          v5.4           |                                                                     |
19|:----------- | :---------------------:| :--------------------: | :--------------------: | :--------------------: |  :--------------------: |:------------------------------------------------------------------- |
20|ESP32        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |                                                                     |
21|ESP32-S2     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |                                                                     |
22|ESP32-C3     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |                                                                     |
23|ESP32-S3     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_S3)           |
24|ESP32-C2     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32-C2)           |
25|ESP32-C6     |                        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_C6)           |
26|ESP32-H2     |                        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |  ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_H2)           |
27|ESP32-P4     |                        |                        |                        | ![alt text][supported] |  ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32-P4)           |
28|ESP32-C5     |                        |                        |                        |                        |  ![alt text][preview]   |[Announcement](https://www.espressif.com/en/news/ESP32-C5)           |
29|ESP32-C61    |                        |                        |                        |                        |  ![alt text][preview]   |[Announcement](https://www.espressif.com/en/products/socs/esp32-c61) |
30
31[supported]: https://img.shields.io/badge/-supported-green "supported"
32[preview]: https://img.shields.io/badge/-preview-orange "preview"
33
34There are variants of revisions for a series of chips. See [Compatibility Between ESP-IDF Releases and Revisions of Espressif SoCs](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY.md) for the details of the compatibility between ESP-IDF and chip revisions.
35
36Espressif SoCs released before 2016 (ESP8266 and ESP8285) are supported by [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK) instead.
37
38# Developing With ESP-IDF
39
40## Setting Up ESP-IDF
41
42See https://idf.espressif.com/ for links to detailed instructions on how to set up the ESP-IDF depending on chip you use.
43
44**Note:** Each SoC series and each ESP-IDF release has its own documentation. Please see Section [Versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html) on how to find documentation and how to checkout specific release of ESP-IDF.
45
46### Non-GitHub forks
47
48ESP-IDF uses relative locations as its submodules URLs ([.gitmodules](.gitmodules)). So they link to GitHub. If ESP-IDF is forked to a Git repository which is not on GitHub, you will need to run the script [tools/set-submodules-to-github.sh](tools/set-submodules-to-github.sh) after git clone.
49
50The script sets absolute URLs for all submodules, allowing `git submodule update --init --recursive` to complete. If cloning ESP-IDF from GitHub, this step is not needed.
51
52## Finding a Project
53
54As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in Getting Started, ESP-IDF comes with some example projects in the [examples](examples) directory.
55
56Once you've found the project you want to work with, change to its directory and you can configure and build it.
57
58To start your own project based on an example, copy the example project directory outside of the ESP-IDF directory.
59
60# Quick Reference
61
62See the Getting Started guide links above for a detailed setup guide. This is a quick reference for common commands when working with ESP-IDF projects:
63
64## Setup Build Environment
65
66(See the Getting Started guide listed above for a full list of required steps with more details.)
67
68* Install host build dependencies mentioned in the Getting Started guide.
69* Run the install script to set up the build environment. The options include `install.bat` or `install.ps1` for Windows, and `install.sh` or `install.fish` for Unix shells.
70* Run the export script on Windows (`export.bat`) or source it on Unix (`source export.sh`) in every shell environment before using ESP-IDF.
71
72## Configuring the Project
73
74* `idf.py set-target <chip_name>` sets the target of the project to `<chip_name>`. Run `idf.py set-target` without any arguments to see a list of supported targets.
75* `idf.py menuconfig` opens a text-based configuration menu where you can configure the project.
76
77## Compiling the Project
78
79`idf.py build`
80
81... will compile app, bootloader and generate a partition table based on the config.
82
83## Flashing the Project
84
85When the build finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this automatically by running:
86
87`idf.py -p PORT flash`
88
89Replace PORT with the name of your serial port (like `COM3` on Windows, `/dev/ttyUSB0` on Linux, or `/dev/cu.usbserial-X` on MacOS. If the `-p` option is left out, `idf.py flash` will try to flash the first available serial port.
90
91This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with `idf.py menuconfig`.
92
93You don't need to run `idf.py build` before running `idf.py flash`, `idf.py flash` will automatically rebuild anything which needs it.
94
95## Viewing Serial Output
96
97The `idf.py monitor` target uses the [esp-idf-monitor tool](https://github.com/espressif/esp-idf-monitor) to display serial output from Espressif SoCs. esp-idf-monitor also has a range of features to decode crash output and interact with the device. [Check the documentation page for details](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
98
99Exit the monitor by typing Ctrl-].
100
101To build, flash and monitor output in one pass, you can run:
102
103`idf.py flash monitor`
104
105## Compiling & Flashing Only the App
106
107After the initial flash, you may just want to build and flash just your app, not the bootloader and partition table:
108
109* `idf.py app` - build just the app.
110* `idf.py app-flash` - flash just the app.
111
112`idf.py app-flash` will automatically rebuild the app if any source files have changed.
113
114(In normal development there's no downside to reflashing the bootloader and partition table each time, if they haven't changed.)
115
116## Erasing Flash
117
118The `idf.py flash` target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run `idf.py erase-flash`.
119
120This can be combined with other targets, ie `idf.py -p PORT erase-flash flash` will erase everything and then re-flash the new app, bootloader and partition table.
121
122# Resources
123
124* Documentation for the latest version: https://docs.espressif.com/projects/esp-idf/. This documentation is built from the [docs directory](docs) of this repository.
125
126* [Beginner's Guide to Key Concepts and Resources of ESP-IDF](https://youtu.be/J8zc8mMNKtc?feature=shared)
127
128* The [esp32.com forum](https://esp32.com/) is a place to ask questions and find community resources.
129
130* [Check the Issues section on github](https://github.com/espressif/esp-idf/issues) if you find a bug or have a feature request. Please check existing Issues before opening a new one.
131
132* If you're interested in contributing to ESP-IDF, please check the [Contributions Guide](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/index.html).
133

README_CN.md

1# Espressif 物联网开发框架
2
3* [English Version](./README.md)
4
5ESP-IDF 是乐鑫官方推出的物联网开发框架,支持 Windows、Linux 和 macOS 操作系统。
6
7# ESP-IDF 版本支持期限
8
9![支持期限](https://dl.espressif.com/dl/esp-idf/support-periods.svg?v=1)
10
11- 请参考 [ESP-IDF 支持政策](SUPPORT_POLICY_CN.md) 以及 [相关文档](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/versions.html) 了解更多关于 ESP-IDF 版本的信息。
12- 请参考 [ESP-IDF 版本停止维护 (EOL) 公告](https://www.espressif.com/zh-hans/support/documents/advisories?keys=&field_type_of_advisory_tid%5B%5D=817)13
14# ESP-IDF 与乐鑫芯片
15
16下表总结了乐鑫芯片在 ESP-IDF 各版本中的支持状态,其中 ![alt text][supported] 代表已支持,![alt text][preview] 代表目前处于预览支持状态。预览支持状态通常有时间限制,而且仅适用于测试版芯片。请确保使用与芯片相匹配的 ESP-IDF 版本。
17
18|芯片         |          v5.0          |          v5.1          |          v5.2          |          v5.3          |          v5.4          |                                                                           |
19|:----------- | :---------------------:| :--------------------: | :--------------------: | :--------------------: | :--------------------: | :------------------------------------------------------------------------ |
20|ESP32        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |                                                                           |
21|ESP32-S2     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |                                                                           |
22|ESP32-C3     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |                                                                           |
23|ESP32-S3     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_S3)           |
24|ESP32-C2     | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-C2)           |
25|ESP32-C6     |                        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_C6)           |
26|ESP32-H2     |                        | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_H2)           |
27|ESP32-P4     |                        |                        |                        | ![alt text][supported] | ![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-P4)           |
28|ESP32-C5     |                        |                        |                        |                        | ![alt text][preview]   | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-C5)           |
29|ESP32-C61    |                        |                        |                        |                        | ![alt text][preview]   | [芯片发布公告](https://www.espressif.com/zh-hans/products/socs/esp32-c61) |
30
31[supported]: https://img.shields.io/badge/-%E6%94%AF%E6%8C%81-green "supported"
32[preview]: https://img.shields.io/badge/-%E9%A2%84%E8%A7%88-orange "preview"
33
34每款乐鑫芯片都可能有不同版本。建议参考 [ESP-IDF 版本与乐鑫芯片版本兼容性](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY_CN.md),了解 ESP-IDF 版本与各芯片版本之间的兼容性。
35
36对于 2016 年之前发布的乐鑫芯片(包括 ESP8266 和 ESP8285),请参考 [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK)37
38# 使用 ESP-IDF 进行开发
39
40## 搭建 ESP-IDF 开发环境
41
42关于不同芯片如何搭建 ESP-IDF 的开发环境,请参考 https://idf.espressif.com/43
44**注意:** 不同系列芯片和不同 ESP-IDF 版本都有其对应的文档。请参阅[版本](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/versions.html)部分,获得关于如何查找文档以及如何检出 ESP-IDF 的特定发行版的详细信息。
45
46### 非 GitHub 分叉的 ESP-IDF 项目
47
48ESP-IDF 中的子模块采用相对路径([详见 .gitmodules 文件](.gitmodules)),所以它们会指向 GitHub。 如果 ESP-IDF 被分叉到的仓库不在 GitHub 上,那么你需要在克隆结束后运行该脚本 [tools/set-submodules-to-github.sh](tools/set-submodules-to-github.sh)。
49
50这个脚本会为所有的子模块设置绝对路径,接着可以通过 `git submodule update --init --recursive` 完成子模块的更新。如果 ESP-IDF 是从 GitHub 上克隆得到,则不需要此步骤。
51
52## 寻找项目
53
54除了入门指南中提到的 [esp-idf 模板项目](https://github.com/espressif/esp-idf-template),ESP-IDF 的 [examples](examples) 目录下还带有很多其它示例项目。
55
56一旦找到了需要的项目,便可以进入该目录,执行配置和构建操作。
57
58如果要基于示例工程开始你自己的项目,请将示例工程复制到 ESP-IDF 目录之外。
59
60# 快速参考
61
62详细的使用方法请参考上面入门指南的链接,这里仅仅列举一些 ESP-IDF 项目开发中常用的命令:
63
64## 设置构建环境
65
66请参考入门指南中列出的详细步骤。
67
68* 在主机中安装入门指南中提到的构建所依赖的工具。
69* 运行安装脚本来设置构建环境。可为 Windows shell 选择 `install.bat` 或 `install.ps1`,为 Unix shell 选择 `install.sh` 和 `install.fish`。
70* 在使用 ESP-IDF 之前,需要在 shell 中运行导出脚本。Windows 下可运行 `export.bat`,Unix 下可运行 `source export.sh`。
71
72## 配置项目
73
74* `idf.py set-target <chip_name>` 可将项目的目标芯片设置为 `<chip_name>`。运行 `idf.py set-target`,不用带任何参数,可查看所有支持的目标芯片列表。
75* `idf.py menuconfig` 可打开一个基于文本的配置菜单,可以用来对项目进行配置。
76
77## 编译项目
78
79`idf.py build`
80
81编译应用程序,引导程序,并根据配置生成分区表。
82
83## 烧写项目
84
85当构建结束,终端会打印出一条命令行,告知如何使用 esptool.py 工具烧写项目到芯片中。但你也可以运行下面这条命令来自动烧写:
86
87`idf.py -p PORT flash`
88
89将其中的 PORT 替换为系统中实际串口的名字(比如 Windows 下的 `COM3`,Linux 下的 `/dev/ttyUSB0`,或者 macOS 下的 `/dev/cu.usbserial-X`。如果省略 `-p` 选项,`idf.py flash` 会尝试使用第一个可用的串口进行烧写。
90
91这会烧写整个项目(包括应用程序,引导程序和分区表)到芯片中,此外还可以使用 `idf.py menuconfig` 来调整串口烧写相关的配置。
92
93不必先运行 `idf.py build` 再运行 `idf.py flash`,`idf.py flash` 会根据需要自动重新构建项目。
94
95## 观察串口输入
96
97`idf.py monitor` 会调用 [esp-idf-monitor 工具](https://github.com/espressif/esp-idf-monitor)来显示乐鑫芯片的串口输出。esp-idf-monitor 还包含一系列的功能来解析程序崩溃后的输出结果并与设备进行交互。更多详细内容,请参阅[文档](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
98
99输入 `Ctrl-]` 可退出监视器。
100
101想要一次性执行构建、烧写和监视,可以运行如下命令:
102
103`idf.py flash monitor`
104
105## 仅编译并烧写应用程序
106
107在第一次烧写过后,你可能只想构建并烧写你的应用程序,不包括引导程序和分区表:
108
109* `idf.py app` - 仅构建应用程序。
110* `idf.py app-flash` - 仅烧写应用程序。
111
112`idf.py app-flash` 会自动判断是否有源文件发生了改变然后重新构建应用程序。
113
114(在正常的开发中,即使引导程序和分区表没有发生变化,每次都重新烧写它们并不会带来什么危害。)
115
116## 擦除 Flash
117
118`idf.py flash` 并不会擦除 flash 上所有的内容,但是有时候我们需要设备恢复到完全擦除的状态,尤其是分区表发生了变化或者 OTA 应用升级时。要擦除整块 flash 请运行 `idf.py erase-flash`。
119
120这条命令还可以和其余命令整合在一起,`idf.py -p PORT erase-flash flash` 会擦除一切然后重新烧写新的应用程序、引导程序和分区表。
121
122# 其它参考资源
123
124* 最新版的文档:https://docs.espressif.com/projects/esp-idf/ ,该文档是由本仓库 [docs 目录](docs) 构建得到。
125
126* [初学者指南:主要概念和资源](https://www.bilibili.com/video/BV1114y1r7du/)
127
128* 可以前往 [esp32.com 论坛](https://esp32.com/) 提问,挖掘社区资源。
129
130* 如果你在使用中发现了错误或者需要新的功能,请先[查看 GitHub Issues](https://github.com/espressif/esp-idf/issues),确保该问题没有重复提交。
131
132* 如果你有兴趣为 ESP-IDF 作贡献,请先阅读[贡献指南](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/index.html)133