-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[TOOLS] Add DTC (Devicetree Compiler) tools #10431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
📌 Code Review Assignment🏷️ Tag: documentationPath: Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-06-25 01:51 UTC)
📝 Review Instructions
|
For windows: RT-Thread/env-windows#37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我只对 dtc.md 做了审阅。请检查。
@@ -0,0 +1,270 @@ | |||
# DTC (Devicetree Compiler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请将这行改成:
@page page_device_dtc Devicetree Compiler
然后在 documentation/6.components/device-driver/INDEX.md
中加入一行,位置我觉得可以放在第二个。
- .....
- @subpage page_device_dtc
- ......
这样这个 markdown 文件就可以转化成一个 html page 了,目前内核文档一旦合入 master 后会及时同步在:https://rt-thread.github.io/rt-thread/。如果要在 merge 之前,在本地查看文档修改后生成的 html 的效果,可以参考 https://rt-thread.github.io/rt-thread/page_howto_doxygen.html#autotoc_md3
@@ -0,0 +1,270 @@ | |||
# DTC (Devicetree Compiler) | |||
|
|||
## Introduction to the DTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个缩小一级,即将 ##
改成 #
以下各级标题依次类推。
|
||
## Introduction to the DTC | ||
|
||
Device Tree Compiler, dtc, takes as input a device-tree in a given format and outputs a device-tree in another format for booting kernels on embedded systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
takes a device-tree as input in a ......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Device Tree Compiler, dtc, takes as input a device-tree in a given format and outputs a device-tree in another format for booting kernels on embedded systems. | ||
Typically, the input format is "dts" (device-tree source), a human readable source format, and creates a "dtb" (device-tree binary), or binary format as output. | ||
|
||
> If you not install dtc tools in your host system, the dtc module will tell you how to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have not installed dtc tools ......
### Generate DTS | ||
|
||
When you get a DTB or FDT file from firmware or the other runtime system, you may want to convert it to dts for reading easier. Just do in your Python or SConscript, dummpy.dtb, eg.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最后一句话没看懂是写的什么意思?你是想说,下面是一个 SConscript 文件的例子,假设需要转化的 DTB 文件是 “dummpy.dtb”。如果是这个意思,机翻如下:
The following is an example of an SConscript file, assuming that the DTB file to be converted is dummpy.dtb
.
|
||
#### Include and Macros | ||
|
||
Gog, dtc is not supports preprocess like C preprocessor (cpp), but you can use cpp to do it in the dts, don't worry, we have appended the step in dtc module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gog 是什么?
“ we have appended the step in dtc module.” 这是想表达什么意思?是想说我们已经支持了预处理吗?如果是这样,可以直接说:we have supported preprocessor in dts.
我通读了一下这一段 “Include and Macros” 很可惜感觉没有看明白想说什么?能够先用中文在这里介绍一下?
dtc.dts_to_dtb(RTT_ROOT, ["dummpy.dts"], include_paths = ['dm/include', 'firmware']) | ||
``` | ||
|
||
Maybe you have other ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文档中不要出现反问,没有确定的东西不要出现在指导文档中感觉没有意义。
}; | ||
}; | ||
|
||
dsp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得更好的做法是,对于 soc 级别的 dtsi 文件中,所有的设备都应该 disabled。在 board level 的 dts 文件中再选择性的 enable 即可。
|
||
When you have some `dt-bindings` include files or macros, like this: | ||
|
||
```c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dts 语法是 json,所以这里感觉用
```json
更好
|
||
### Raw options | ||
|
||
DTC have more raw options than generate dts show by `dtc --help`, like to append them like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是不是没有断句?没有看懂说什么。
是否可以先写出中文,然后机翻一下?
有个 general 的疑问,RT-Thread 的 dts 是准备全部重写还是打算尽量复用 linux 中的 dts? |
尽可能重用linux dts,所以语法也基本上是linux的一套 |
Signed-off-by: GuEe-GUI <[email protected]>
语法是一样的,不分 Linux 还是 RT-Thread,只是部分驱动对设备树的解析方式是复用 Linux 的,文档已经更新,烦请继续 review。 |
拉取/合并请求描述:(PR description)
[
Devicetree Compiler for dts build
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up