Skip to content

Commit 7380451

Browse files
committed
Correct post-build filtering options
1 parent 401a3c8 commit 7380451

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

tools/targets/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def is_PSA_secure_target(self):
356356
def is_PSA_non_secure_target(self):
357357
return 'NSPE_Target' in self.labels
358358

359-
def get_post_build_hook(self, toolchain):
359+
def get_post_build_hook(self, toolchain_labels):
360360
"""Initialize the post-build hooks for a toolchain. For now, this
361361
function only allows "post binary" hooks (hooks that are executed
362362
after the binary image is extracted from the executable file)
@@ -401,9 +401,8 @@ def get_post_build_hook(self, toolchain):
401401
("not found in class '%s'" % class_name))
402402
# Check if the hook specification also has toolchain restrictions
403403
toolchain_restrictions = set(hook_data.get("toolchains", []))
404-
toolchain_labels = set(c.__name__ for c in getmro(toolchain.__class__))
405404
if toolchain_restrictions and \
406-
not toolchain_labels.intersection(toolchain_restrictions):
405+
not set(toolchain_labels).intersection(toolchain_restrictions):
407406
return
408407
return getattr(cls, function_name)
409408

tools/toolchains/mbed_toolchain.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
136136
self.target = target
137137
self.name = self.__class__.__name__
138138

139-
# compile/assemble/link/binary hooks
140-
self._post_build_hook = target.get_post_build_hook(self.name)
141139

142140
# Toolchain flags
143141
self.flags = deepcopy(build_profile or self.profile_template)
@@ -754,9 +752,13 @@ def link_program(self, r, tmp_path, name):
754752
else:
755753
updatable = None
756754

757-
if self._post_build_hook:
755+
# compile/assemble/link/binary hooks
756+
post_build_hook = self.target.get_post_build_hook(
757+
self._get_toolchain_labels()
758+
)
759+
if post_build_hook:
758760
self.progress("post-build", name)
759-
self._post_build_hook(self, r, elf, full_path)
761+
post_build_hook(self, r, elf, full_path)
760762
# Initialize memap and process map file. This doesn't generate output.
761763
self.mem_stats(mapfile)
762764

0 commit comments

Comments
 (0)