zephyr/scripts/dts
Grzegorz Swiderski dcd8d60119 scripts: dts: Support DT_NODE_HAS_PROP(node_id, ranges)
This is a one-line fix for edtlib, which lets gen_defines.py indicate
whether the `ranges` property exists within a given node.

Although address translation through ranges is typically automatic,
users can choose to manually inspect ranges using DT_FOREACH_RANGE(),
DT_NUM_RANGES(), and other DT_RANGES_* macros. These can be used to
implement manual translation at runtime, which is currently done for
PCIe controllers.

The only thing missing is being able to check if a node contains an
empty `ranges;`, which signifies a 1:1 translation to the parent bus.
Checking DT_NUM_RANGES() is insufficient, because it returns zero
whether or not `ranges;` is present.

It should be possible to use DT_NODE_HAS_PROP(), but it was not working,
because edtlib ignores properties which are undeclared in bindings and
don't have a default type. Add a missing PropertySpec for `ranges` with
"compound" type; it can't be "array" because it can be empty-valued.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-02 09:56:01 -07:00
..
python-devicetree scripts: dts: Support DT_NODE_HAS_PROP(node_id, ranges) 2023-08-02 09:56:01 -07:00
README.txt
gen_defines.py scripts: gen_defines.py: Update doc reference 2023-08-01 08:20:24 +00:00
gen_driver_kconfig_dts.py
gen_dts_cmake.py

README.txt

This directory used to contain the edtlib.py and dtlib.py libraries
and tests, alongside the gen_defines.py script that uses them for
converting DTS to the C macros used by Zephyr.

The libraries and tests have now been moved to the 'python-devicetree'
subdirectory.

We are now in the process of extracting edtlib and dtlib into a
standalone source code library that we intend to share with other
projects.

Links related to the work making this standalone:

    https://pypi.org/project/devicetree/
    https://python-devicetree.readthedocs.io/en/latest/
    https://github.com/zephyrproject-rtos/python-devicetree

The 'python-devicetree' subdirectory you find here next to this
README.txt matches the standalone python-devicetree repository linked
above.

For now, the 'main' copy will continue to be hosted here in the zephyr
repository. We will mirror changes into the standalone repository as
needed; you can just ignore it for now.

Code in the zephyr repository which needs these libraries will import
devicetree.edtlib from now on, but the code will continue to be found
by manipulating sys.path for now.

Eventually, as APIs stabilize, the python-devicetree code in this
repository will disappear, and a standalone repository will be the
'main' one.