7772cec6bd
When we have an empty Devicetree, ie, ``` /dts-v1/; / { }; ``` The node's dep_ordinal is never initialized because the node graph is empty. This ends up with invalid ordinal tokens (-1) in devicetree_generated.h which in turn produce some cryptic compiler errors, see e.g. ``` error: pasting "dts_ord_" and "-" does not give a valid preprocessing token 95 | #define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_, DT_DEP_ORD(node_id)) ... include/zephyr/devicetree.h:2498:41: note: in expansion of macro 'DT_FOREACH_OKAY_HELPER' 2498 | #define DT_FOREACH_STATUS_OKAY_NODE(fn) DT_FOREACH_OKAY_HELPER(fn) | ^~~~~~~~~~~~~~~~~~~~~~ include/zephyr/device.h:1022:1: note: in expansion of macro 'DT_FOREACH_STATUS_OKAY_NODE' 1022 | DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL) ``` (devicetree_generated.h) ``` ... #define DT_N_ORD -1 #define DT_N_ORD_STR_SORTABLE 000-1 ... ``` This patch makes sure root node is always inserted (without any target) so that it gets initialized later. Discovered as part of https://github.com/zephyrproject-rtos/zephyr/pull/63696 Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com> |
||
---|---|---|
.. | ||
python-devicetree | ||
README.txt | ||
gen_defines.py | ||
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.