Skip to content

Commit 4730d91

Browse files
committed
Merge branch 'docs/cmake_utilities' into 'master'
docs(cmake_utilities): add rst user guide Closes AEG-1005 See merge request ae_group/esp-iot-solution!1088
2 parents de6abfb + 12c244d commit 4730d91

File tree

6 files changed

+103
-23
lines changed

6 files changed

+103
-23
lines changed

docs/en/basic/cmake_utilities.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
CMake Utilities
2+
===================
3+
4+
:link_to_translation:`zh_CN:[中文]`
5+
6+
``cmake_utilities`` is a collection of CMake utilities that are commonly used in the components of ``esp-iot-solution``.
7+
8+
Supported Features:
9+
10+
- ``project_include.cmake``: add additional features like ``DIAGNOSTICS_COLOR`` to the project. The file will be automatically parsed, for details, please refer `project-include-cmake <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/build-system.html#project-include-cmake>`__.
11+
- ``package_manager.cmake``: provides functions to manager components' versions, etc.
12+
- ``gcc.cmake``: manager the GCC compiler options like ``LTO`` through menuconfig.
13+
- ``relinker.cmake`` provides a way to move IRAM functions to flash to save RAM space.
14+
- ``gen_compressed_ota.cmake``: add new command ``idf.py gen_compressed_ota`` to generate ``xz`` compressed OTA binary. please refer `xz <https://github.com/espressif/esp-iot-solution/tree/master/components/utilities/xz>`__.
15+
- ``gen_single_bin.cmake``: add new command ``idf.py gen_single_bin`` to generate single combined bin file (combine app, bootloader, partition table, etc).
16+
17+
How to Use
18+
----------
19+
20+
Use
21+
---
22+
23+
1. Add dependency of this component in your component or project’s ``idf_component.yml``.
24+
25+
.. code:: yaml
26+
27+
dependencies:
28+
espressif/cmake_utilities: "0.*"
29+
30+
2. Include the CMake Features/Script in your component’s or project’s ``CMakeLists.txt`` after ``idf_component_register``.
31+
32+
.. code:: none
33+
34+
// Note: should remove .cmake postfix when using include(), otherwise the requested file will not found
35+
// Note: should place this line after `idf_component_register` function
36+
// only include the one you needed.
37+
include(package_manager)
38+
39+
3. Then you can use the corresponding features provided by the CMake script.
40+
41+
Detailed Reference
42+
---------------------
43+
44+
1. `relinker <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/relinker.md>`__
45+
2. `gen_compressed_ota <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gen_compressed_ota.md>`__
46+
3. `GCC Optimization <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gcc.md>`__
47+

docs/en/basic/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Basic Component
99
Communication Bus <bus>
1010
I2S LCD Driver <i2s_lcd>
1111
Boards Support<boards>
12+
CMake Utilities <cmake_utilities>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
CMake Utilities
2+
===================
3+
4+
:link_to_translation:`en:[English]`
5+
6+
``cmake_utilities`` 是 ``esp-iot-solution`` 组件中常用的 CMake 工具集合。
7+
8+
支持的功能:
9+
10+
- ``project_include.cmake``: 为项目添加额外的功能,例如 ``DIAGNOSTICS_COLOR``。文件将被自动解析,详情请参考 `project-include-cmake <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/build-system.html#project-include-cmake>`__。
11+
- ``package_manager.cmake``: 提供了管理组件版本等功能。
12+
- ``gcc.cmake``: 通过 menuconfig 管理 GCC 编译器选项,例如 ``LTO``。
13+
- ``relinker.cmake`` 提供了一种将 IRAM 函数移动到 Flash 以节省 RAM 空间的方法。
14+
- ``gen_compressed_ota.cmake``: 添加了新命令 ``idf.py gen_compressed_ota`` 以生成 ``xz`` 压缩的 OTA 二进制文件。详情请参考 `xz <https://github.com/espressif/esp-iot-solution/tree/master/components/utilities/xz>`__.
15+
- ``gen_single_bin.cmake``: 添加了新命令 ``idf.py gen_single_bin`` 以生成单个组合 bin 文件(组合 app、bootloader、分区表等)。
16+
17+
如何使用
18+
----------
19+
20+
1. 在你的组件或项目的 ``idf_component.yml`` 中添加此组件的依赖。
21+
22+
.. code:: yaml
23+
24+
dependencies:
25+
espressif/cmake_utilities: "0.*"
26+
27+
2. 在你的组件或项目的 ``CMakeLists.txt`` 中的 ``idf_component_register`` 后包含 CMake 功能/脚本。
28+
29+
.. code:: none
30+
31+
// 注意:使用 include() 时应删除 .cmake 后缀,否则将找不到请求的文件
32+
// 注意:应在 `idf_component_register` 函数之后放置此行
33+
// 只包含你需要的功能。
34+
include(package_manager)
35+
36+
3. 然后你可以使用 CMake 脚本提供的相应功能。
37+
38+
详细参考
39+
---------------------
40+
41+
1. `relinker <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/relinker.md>`__
42+
2. `gen_compressed_ota <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gen_compressed_ota.md>`__
43+
3. `GCC Optimization <https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gcc.md>`__

docs/zh_CN/basic/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
通信总线 <bus>
1010
I2S LCD 驱动 <i2s_lcd>
1111
板级支持 <boards>
12+
CMake 工具集 <cmake_utilities>

tools/cmake_utilities/README.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,15 @@
44

55
This component is aiming to provide some useful CMake utilities outside of ESP-IDF.
66

7-
## Use
7+
**Supported features:**
88

9-
1. Add dependency of this component in your component or project's idf_component.yml.
9+
- `project_include.cmake`: add additional features like `DIAGNOSTICS_COLOR` to the project. The file will be automatically parsed, for details, please refer [project-include-cmake](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/build-system.html#project-include-cmake>).
10+
- `package_manager.cmake`: provides functions to manager components' versions, etc.
11+
- `gcc.cmake`: manager the GCC compiler options like `LTO` through menuconfig.
12+
- `relinker.cmake` provides a way to move IRAM functions to flash to save RAM space.
13+
- `gen_compressed_ota.cmake`: add new command `idf.py gen_compressed_ota` to generate `xz` compressed OTA binary. please refer [xz](https://github.com/espressif/esp-iot-solution/tree/master/components/utilities/xz).
14+
- `gen_single_bin.cmake`: add new command `idf.py gen_single_bin` to generate single combined bin file (combine app, bootloader, partition table, etc).
1015

11-
```yml
12-
dependencies:
13-
espressif/cmake_utilities: "0.*"
14-
```
16+
## User Guide
1517

16-
2. Include the CMake file you need in your component's CMakeLists.txt after `idf_component_register`, or in your project's CMakeLists.txt
17-
18-
```cmake
19-
// Note: should remove .cmake postfix when using include(), otherwise the requested file will not found
20-
// Note: should place this line after `idf_component_register` function
21-
// only include the one you needed.
22-
include(package_manager)
23-
```
24-
25-
3. Then you can use the corresponding CMake function which is provided by the CMake file.
26-
27-
## Supported features
28-
29-
1. [relinker](https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/relinker.md)
30-
2. [gen_compressed_ota](https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gen_compressed_ota.md)
31-
3. [GCC Optimization](https://github.com/espressif/esp-iot-solution/blob/master/tools/cmake_utilities/docs/gcc.md)
18+
[cmake_utilities user guide](https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/basic/cmake_utilities.html)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
version: "0.5.3"
1+
version: "1.0.0"
22
description: A collection of useful cmake utilities
33
url: https://github.com/espressif/esp-iot-solution/tree/master/tools/cmake_utilities
4+
documentation: https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/basic/cmake_utilities.html
45
issues: https://github.com/espressif/esp-iot-solution/issues
56
dependencies:
67
idf: ">=4.1"

0 commit comments

Comments
 (0)