Python's sets are not deterministic.
`devices` were already sorted but `dev_supports` is still a
non-deterministic set. Sort dev_supports to make the graph output
deterministic.
Fixes commit 29942475c5 ("scripts: gen_handles: output dependency graph")
It is quite ironic that this initial and non-deterministic graph commit
was concurrent with and slightly delayed other commit
f896fc2306 ("scripts: gen_handles: Sort the device handles") which
fixed another, similar non-determinism issue in the same area. A true
"whack-a-mole"!
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This allows sorting objects consistently without having to specific a
key.
No functional change yet.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
It is only available if CONFIG_DEVICE_DEPS=y, so the ZephyrElf class
would fail to load if it does not treat _DEVICE_STRUCT_HANDLES_OFFSET as
optional.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Rename the device dependencies array variable to use the "deps" name, in
line with latest renamings in device.h
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Based on investigations with relocatable `.elf` files, the symbol table
data in relocatable files is not shifted by the section address. Remove
the shift from these files to ensure that data can be pulled from the
symbol table.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Retrieve the section holding the symbol data directly from the symbol
information, instead of trying to find a section that contains data at
the correct address. The later approach does not work for relocatable
files, which contain multiple sections all containing data in
overlapping temporary memory addresses (usually starting at 0).
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The elf_parser library now generates a dot file with device dependencies
that can be later rendered using Graphviz. Each node in the diagram
contains the device label (taken from DT node). In some cases the label
property can be None, leading to build failures like:
```
line 273, in device_dependency_graph
text = '{:s}\\nOrdinal: {:d} | Handle: {:d}\\n{:s}'.format(
TypeError: unsupported format string passed to NoneType.__format__
```
This patch switches to node name instead, which will always be set to
some value. This value is actually what devices get now as a name if
they do not have a label set.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
If a device manually specifies that it depends on a second DT device,
add the first device to the second devices list of supported devices.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Output the final dependency graph as a `.dot` file, which when rendered
by graphviz can be easier to comprehend than the text descriptions.
This output is optional in that it will not be generated if `graphviz`
is not installed.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Adds a python module intended to simplify other scripts that need to
work with device information compiled into the first pass `.elf` file.
Scripts utilizing this module can focus on iterating over dependency
graphs to generate the desired output, instead of also needing to
extract and build the graphs in the first place.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>