Skip to content

Commit

Permalink
scripts: build: elf_parser: _DEVICE_STRUCT_HANDLES_OFFSET is optional
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
gmarull authored and carlescufi committed Sep 1, 2023
1 parent 78d9ebb commit a4858c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/build/elf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ def __init__(self, elf, sym):
# Point to the handles instance associated with the device;
# assigned by correlating the device struct handles pointer
# value with the addr of a Handles instance.
ordinal_offset = self.elf.ld_consts['_DEVICE_STRUCT_HANDLES_OFFSET']
self.obj_ordinals = self._data_native_read(ordinal_offset)
self.obj_ordinals = None
if '_DEVICE_STRUCT_HANDLES_OFFSET' in self.elf.ld_consts:
ordinal_offset = self.elf.ld_consts['_DEVICE_STRUCT_HANDLES_OFFSET']
self.obj_ordinals = self._data_native_read(ordinal_offset)

self.obj_pm = None
if '_DEVICE_STRUCT_PM_OFFSET' in self.elf.ld_consts:
pm_offset = self.elf.ld_consts['_DEVICE_STRUCT_PM_OFFSET']
Expand Down

0 comments on commit a4858c4

Please sign in to comment.