Add an EDT.compat2enabled attribute that maps compatibles to enabled devicetree nodes that implement them. For example, EDT.compat2enabled["foo"] is a list of all enabled nodes with "foo" in the 'compatible' property. The old Node.instance_no functionality can be implemented in terms of EDT.compat2enabled, so remove Node.instance_no. EDT.compat2enabled is more flexible and easier to understand. Simplify main() in gen_defines.py by using EDT.compat2enabled to generate the DT_COMPAT_<compatible> existence macros. The behavior is slightly different now, as DT_COMPAT_<compatible> is generated for enabled nodes that don't have a binding as well, but that might be an improvement overall. It probably doesn't hurt at least. EDT.compat2enabled simplifies the implementation of the new $(dt_compat_get_str) preprocessor function in https://github.com/zephyrproject-rtos/zephyr/pull/21560. That was the original motivation. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> |
||
|---|---|---|
| .. | ||
| test-bindings | ||
| test-bindings-2 | ||
| dtlib.py | ||
| edtlib.py | ||
| gen_defines.py | ||
| grutils.py | ||
| test-multidir.dts | ||
| test.dts | ||
| testdtlib.py | ||
| testedtlib.py | ||