Part 1
요약·해설
Single source 원칙, dtlib·edtlib·gen_defines 계층, Linux/dtc 호환성과 아직 남은 전환 작업을 구분했습니다.
Source
Devicetree 단일화
Parser
dtlib · dtc
Layer
edtlib · gen_defines
Future
Linux 공유
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
원문 SHA-256
8A19D1D3469E592E8F14B484EDA1F12750465A15B93CED72B15C7B9AF21D87E5
.. _dt-design:
Design goals
############
Zephyr's use of devicetree has evolved significantly over time, and further
changes are expected. The following are the general design goals, along with
specific examples about how they impact Zephyr's source code, and areas where
more work remains to be done.
Single source for hardware information
**************************************
Zephyr's built-in device drivers and sample applications shall obtain
configurable hardware descriptions from devicetree.
Examples
========
- New device drivers shall use devicetree APIs to determine which :ref:`devices
to create <dt-create-devices>`.
- In-tree sample applications shall use :ref:`aliases <dt-alias-chosen>` to
determine which of multiple possible generic devices of a given type will be
used in the current build. For example, the :zephyr:code-sample:`blinky` sample uses this to
determine the LED to blink.
- Boot-time pin muxing and pin control for new SoCs shall be accomplished via a
devicetree-based pinctrl driver
Example remaining work
======================
- Zephyr's :ref:`twister_script` currently use :file:`board.yaml` files to
determine the hardware supported by a board. This should be obtained from
devicetree instead.
- Legacy device drivers currently use Kconfig to determine which instances of a
particular compatible are enabled. This can and should be done with devicetree
overlays instead.
- Board-level documentation still contains tables of hardware support which are
generated and maintained by hand. This can and should be obtained from the
board level devicetree instead.
- Runtime determination of ``struct device`` relationships should be done using
information obtained from devicetree, e.g. for device power management.
.. _dt-source-compatibility:
Source compatibility with other operating systems
*************************************************
Zephyr's devicetree tooling is based on a generic layer which is interoperable
with other devicetree users, such as the Linux kernel.
Zephyr's binding language *semantics* can support Zephyr-specific attributes,
but shall not express Zephyr-specific relationships.
Examples
========
- Zephyr's devicetree source parser, :ref:`dtlib.py <dt-scripts>`, is
source-compatible with other tools like `dtc`_ in both directions:
:file:`dtlib.py` can parse ``dtc`` output, and ``dtc`` can parse
:file:`dtlib.py` output.
- Zephyr's "extended dtlib" library, :file:`edtlib.py`, shall not include
Zephyr-specific features. Its purpose is to provide a higher-level view of the
devicetree for common elements like interrupts and buses.
Only the high-level :file:`gen_defines.py` script, which is built on top of
:file:`edtlib.py`, contains Zephyr-specific knowledge and features.
.. _dtc: https://git.kernel.org/pub/scm/utils/dtc/dtc.git/about/
Example remaining work
======================
- Zephyr has a custom :ref:`dt-bindings` language *syntax*. While Linux's
dtschema does not yet meet Zephyr's needs, we should try to follow what it is
capable of representing in Zephyr's own bindings.
- Due to inflexibility in the bindings language, Zephyr cannot support the full
set of bindings supported by Linux.
- Devicetree source sharing between Zephyr and Linux is not done.
Part 3
한국어 전문 번역
설계 목표
Zephyr의 devicetree 사용 방식은 계속 발전해 왔고 앞으로도 바뀔 수 있습니다. 이 문서는 일반적인 설계 목표, source code에 미치는 구체적 영향, 아직 남은 작업을 구분합니다.
Hardware 정보의 단일 출처
Zephyr 내장 device driver와 sample application은 구성 가능한 hardware 설명을 devicetree에서 가져와야 합니다.
적용 예
- 새 device driver는 어떤
struct device를 생성할지 Devicetree API로 결정해야 합니다. - Tree 내부 sample은 같은 종류의 여러 generic device 중 현재 build에서 사용할 항목을 alias로 선택해야 합니다. Blinky sample이 blink할 LED를 고르는 방식이 예입니다.
- 새 SoC의 boot-time pin mux와 pin control은 devicetree 기반 pinctrl driver로 수행해야 합니다.
남은 작업 예
- Twister가 board 지원 hardware를 판별할 때 현재 사용하는
board.yaml정보를 devicetree에서 가져오도록 전환 - Legacy driver가 compatible별 instance enable을 Kconfig로 정하는 방식을 devicetree overlay로 전환
- 사람이 작성·유지하는 board hardware 지원표를 board-level devicetree에서 생성
- Device power management처럼 runtime의
struct device관계를 devicetree 정보로 결정
다른 운영체제와의 source compatibility
Zephyr devicetree tooling은 Linux kernel 같은 다른 devicetree 사용자와 상호 운용되는 generic layer를 기반으로 합니다. Binding 언어의 semantics는 Zephyr 전용 attribute를 지원할 수 있지만 Zephyr에만 존재하는 관계를 표현해서는 안 됩니다.
적용 예
- Source parser
dtlib.py는dtc와 양방향 source compatibility를 유지합니다. dtlib.py가 dtc 출력을 parse하고 dtc도 dtlib.py 출력을 parse할 수 있어야 합니다. - Extended library
edtlib.py에는 Zephyr 전용 기능을 넣지 않습니다. Interrupt와 bus 같은 공통 요소를 더 높은 수준에서 보여 주는 역할입니다. edtlib.py위에서 동작하는 고수준gen_defines.py만 Zephyr 전용 지식과 기능을 가집니다.
남은 작업 예
- Zephyr는 자체 binding syntax를 사용하지만 Linux dt-schema가 표현 가능한 범위는 Zephyr binding에서도 따르도록 노력
- 현재 binding 언어의 유연성 한계 때문에 Linux가 지원하는 binding 전체를 Zephyr가 지원하지 못하는 문제 개선
- Zephyr와 Linux 사이의 Devicetree source 공유 마련
Source
출처
원문 파일의 단락, directive, 표, 코드, symbol, 경로는 영어 원문 영역에 그대로 보존했습니다.