Difference between revisions of "Device tree"
m |
m (→^ phandles: formatting) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <!-- - SECTION - Manually maintained within-NN-wiki links --> | |
<center> | <center> | ||
[[Unix_and_Linux_config|Unix and Linux config]] :: [[Containers_and_virtual_machines|Containers]] :: [[Zephyr_device_driver_model|Zephyr device drivers]] <!-- <link> --><br /> | [[Unix_and_Linux_config|Unix and Linux config]] :: [[Containers_and_virtual_machines|Containers]] :: [[Zephyr_device_driver_model|Zephyr device drivers]] <!-- <link> --><br /> | ||
Line 6: | Line 6: | ||
</center> | </center> | ||
− | <!-- | + | <!-- comentario --> |
+ | == Overview == | ||
2021-08-23 Monday | 2021-08-23 Monday | ||
− | Starting notes for Device Tree, an OS independent framework with its own governance and steering committee, community, web site and on-line documentation. | + | Starting notes for Device Tree, an OS independent framework with its own governance and steering committee, community, web site and on-line documentation. As a contextual note, Device Tree has been part of Linux Kernel Project for many more years than part of Zephyr RTOS Project. Some useful starting point references and documents are linked here in table 1: |
<ul> | <ul> | ||
+ | Device Tree specification at Github: | ||
* https://github.com/devicetree-org/devicetree-specification/releases/tag/v0.3 | * https://github.com/devicetree-org/devicetree-specification/releases/tag/v0.3 | ||
− | + | ||
+ | Zephyr Project Device Tree documentation: | ||
+ | * https://docs.zephyrproject.org/2.6.0/reference/devicetree/api.html | ||
+ | |||
+ | Toradex document on Toradex use of Device Tree: | ||
+ | * https://developer.toradex.com/linux-bsp/how-to/device-tree/device-tree-customization/ | ||
+ | |||
+ | A device tree introduction on a git repository of RaspberryPi foundation. This document explains fundamental device tree data types: | ||
+ | * [[Device_tree_documentation#device-tree.md device-tree.md]] | ||
+ | </ul> | ||
+ | |||
+ | <!-- comentario --> | ||
+ | |||
+ | == [[#top|^]] Some Historical Context == | ||
+ | |||
+ | Some device tree historical context given in this Power Point presentation by Thomas Petazzoni of Free Electrons: | ||
+ | <ul> | ||
+ | * https://elinux.org/images/f/f9/Petazzoni-device-tree-dummies_0.pdf | ||
+ | |||
+ | * https://www.nxp.com/docs/en/application-note/AN5125.pdf | ||
+ | </ul> | ||
+ | |||
+ | <!-- comment --> | ||
+ | |||
+ | == [[#top|^]] DTS Labels == | ||
+ | |||
+ | * https://devicetree-specification.readthedocs.io/en/v0.3/source-language.html | ||
+ | |||
+ | <!-- comentario --> | ||
+ | |||
+ | == [[#top|^]] Device Bindings == | ||
Today Monday studying section 4.0, "Device Bindings" and binding guidelines. May have questions for [https://community.jaredwolff.com/ Jared Wolff] of CircuitDojo, relating to his [https://github.com/circuitdojo/air-quality-wing-zephyr-drivers/|Air Quality Wing] Zephyr driver project and specifically the [https://github.com/circuitdojo/air-quality-wing-zephyr-drivers/tree/main/dts/bindings|dts files in Jared's AQW project]. | Today Monday studying section 4.0, "Device Bindings" and binding guidelines. May have questions for [https://community.jaredwolff.com/ Jared Wolff] of CircuitDojo, relating to his [https://github.com/circuitdojo/air-quality-wing-zephyr-drivers/|Air Quality Wing] Zephyr driver project and specifically the [https://github.com/circuitdojo/air-quality-wing-zephyr-drivers/tree/main/dts/bindings|dts files in Jared's AQW project]. | ||
Line 35: | Line 67: | ||
</ul> | </ul> | ||
− | <!-- | + | <!-- comentario --> |
− | == [[#top|^]] Device Tree | + | == [[#top|^]] Device Tree Bindings Files == |
Noting that in AQW bindings file for SHCT3 sensor there is an <code>include</code> line: | Noting that in AQW bindings file for SHCT3 sensor there is an <code>include</code> line: | ||
Line 77: | Line 109: | ||
<b>QUESTION:</b> how does a developer know to include <code>i2c-device.yaml</code>? | <b>QUESTION:</b> how does a developer know to include <code>i2c-device.yaml</code>? | ||
− | <!-- | + | |
+ | A cerca 2022-06-24 post to Jared Wolff community forum: | ||
+ | |||
+ | * https://community.jaredwolff.com/d/330-not-finding-local-device-bindings | ||
+ | |||
+ | <!-- comentario --> | ||
+ | |||
+ | == [[#top|^]] Element of Device Source == | ||
+ | |||
+ | <i>2023-07-19 stub section to encapsulate elements of device tree source language, e.g. nodes, node labels, phandles and similar</i> | ||
+ | |||
+ | <ul><!-- indenting experiment for local NN wiki page. Awful in that matching 'ul' pair must reside in a later sub-section of this wiki document --> | ||
+ | |||
+ | === [[#top|^]] phandles === | ||
+ | |||
+ | In device tree source `phandles` are akin to C pointers, though technically Ted reads that there are no such elements as pointers in DTS. DTS node properties can be of type `phandle`, `phandles` and `phandle-array` respectively (one at a time) and these node property types are discussed in detail in the Zephyr Project documentation at: | ||
+ | |||
+ | <ul> | ||
+ | * https://docs.zephyrproject.org/latest/build/dts/phandles.html | ||
+ | </ul> | ||
+ | |||
+ | </ul><!-- indenting experiment for local NN wiki page. Awful in that earlier matching 'ul' must reside in an earlier sub-section of this wiki document --> | ||
+ | |||
+ | <!-- odne komentar --> | ||
== [[#top|^]] Zephyr Device Tree API - A System Of Macros == | == [[#top|^]] Zephyr Device Tree API - A System Of Macros == | ||
* https://docs.zephyrproject.org/2.6.0/reference/devicetree/api.html | * https://docs.zephyrproject.org/2.6.0/reference/devicetree/api.html | ||
+ | |||
+ | <!-- comentario --> | ||
+ | |||
+ | == [[#top|^]] Device Tree Undocumented Features == | ||
+ | 0408 - Undocumented Device Tree syntax and features . . . | ||
+ | Early Google search result when seeking info on `/delete-property/` token in Device Tree Source file, observed specifically in Jared Wolff (Circuit Dojo) nfed release tag v1.7.1, active_sleep sample app board overlay file. | ||
+ | * https://elinux.org/Device_Tree_Source_Undocumented | ||
+ | |||
+ | <!-- comentario --> | ||
− | |||
<!-- end of page --> | <!-- end of page --> |
Latest revision as of 20:20, 19 July 2023
Unix and Linux config :: Containers :: Zephyr device drivers
Zephyr RTOS building blocks :: Device Tree Source :: Kconfig :: cmake :: `west` manifest files
Contents
Overview
2021-08-23 Monday Starting notes for Device Tree, an OS independent framework with its own governance and steering committee, community, web site and on-line documentation. As a contextual note, Device Tree has been part of Linux Kernel Project for many more years than part of Zephyr RTOS Project. Some useful starting point references and documents are linked here in table 1:
-
Device Tree specification at Github:
Zephyr Project Device Tree documentation:
Toradex document on Toradex use of Device Tree:
A device tree introduction on a git repository of RaspberryPi foundation. This document explains fundamental device tree data types:
^ Some Historical Context
Some device tree historical context given in this Power Point presentation by Thomas Petazzoni of Free Electrons:
^ DTS Labels
^ Device Bindings
Today Monday studying section 4.0, "Device Bindings" and binding guidelines. May have questions for Jared Wolff of CircuitDojo, relating to his Quality Wing Zephyr driver project and specifically the files in Jared's AQW project.
Latest Zephyr documentation as of 2021-08-23 is here:
Related to or came up in search result in regards to '_P_label' no such symbol defined errors, when board overlay file not specified or not found:
^ Device Tree Bindings Files
Noting that in AQW bindings file for SHCT3 sensor there is an include
line:
Code excerpt, full file from Jared Wolff AQW driver:
# # Copyright (c) 2021 Circuit Dojo LLC # description: Sensirion SHTC3 Temp/Humidity Sensor compatible: "sensirion,shtc3" include: i2c-device.yaml
The file i2c-device.yaml
is found locally in /usr/local/share/ncs/v1.6.1/zephyr/dts/bindings/i2c/i2c-device.yaml
, and this file contains:
Code excerpt, full file from Zephyr project:
# Copyright (c) 2017, Linaro Limited # SPDX-License-Identifier: Apache-2.0 # Common fields for I2C devices include: [base.yaml, power.yaml] on-bus: i2c properties: reg: required: true description: device address on i2c bus label: required: true
QUESTION: how does a developer know to include i2c-device.yaml
?
A cerca 2022-06-24 post to Jared Wolff community forum:
^ Element of Device Source
2023-07-19 stub section to encapsulate elements of device tree source language, e.g. nodes, node labels, phandles and similar
^ phandles
In device tree source `phandles` are akin to C pointers, though technically Ted reads that there are no such elements as pointers in DTS. DTS node properties can be of type `phandle`, `phandles` and `phandle-array` respectively (one at a time) and these node property types are discussed in detail in the Zephyr Project documentation at:
^ Zephyr Device Tree API - A System Of Macros
^ Device Tree Undocumented Features
0408 - Undocumented Device Tree syntax and features . . . Early Google search result when seeking info on `/delete-property/` token in Device Tree Source file, observed specifically in Jared Wolff (Circuit Dojo) nfed release tag v1.7.1, active_sleep sample app board overlay file.