From a4858c40ecaba31d3ab2b80024fe0e9ea29a7f73 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 31 Aug 2023 13:25:50 +0200 Subject: [PATCH] scripts: build: elf_parser: _DEVICE_STRUCT_HANDLES_OFFSET is optional 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 --- scripts/build/elf_parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/build/elf_parser.py b/scripts/build/elf_parser.py index 3dcc8534fe..bd7a970431 100644 --- a/scripts/build/elf_parser.py +++ b/scripts/build/elf_parser.py @@ -100,8 +100,11 @@ class Device(_Symbol): # 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']