36
36
from ..utils import (run_cmd , mkdir , rel_path , ToolException ,
37
37
NotSupportedException , split_path , compile_worker )
38
38
from ..settings import MBED_ORG_USER , PRINT_COMPILER_OUTPUT_AS_LINK
39
- from .. import hooks
40
39
from ..notifier .term import TerminalNotifier
41
40
from ..resources import FileType
42
41
from ..memap import MemapParser
@@ -96,7 +95,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
96
95
self .name = self .__class__ .__name__
97
96
98
97
# compile/assemble/link/binary hooks
99
- self .hook = hooks . Hook ( target , self )
98
+ self ._post_build_hook = target . get_post_build_hook ( self . name )
100
99
101
100
# Toolchain flags
102
101
self .flags = deepcopy (build_profile or self .profile_template )
@@ -653,6 +652,9 @@ def link_program(self, r, tmp_path, name):
653
652
self .progress ("elf2bin" , name )
654
653
self .binary (r , elf , bin )
655
654
655
+ if self ._post_build_hook :
656
+ self .progress ("post-build" , name )
657
+ self ._post_build_hook (self , r , elf , bin )
656
658
# Initialize memap and process map file. This doesn't generate output.
657
659
self .mem_stats (mapfile )
658
660
@@ -1002,9 +1004,6 @@ def assemble(self, source, object, includes):
1002
1004
1003
1005
Side effects:
1004
1006
None
1005
-
1006
- Note:
1007
- This method should be decorated with @hook_tool.
1008
1007
"""
1009
1008
raise NotImplemented
1010
1009
@@ -1024,9 +1023,6 @@ def compile_c(self, source, object, includes):
1024
1023
1025
1024
Side effects:
1026
1025
None
1027
-
1028
- Note:
1029
- This method should be decorated with @hook_tool.
1030
1026
"""
1031
1027
raise NotImplemented
1032
1028
@@ -1046,9 +1042,6 @@ def compile_cpp(self, source, object, includes):
1046
1042
1047
1043
Side effects:
1048
1044
None
1049
-
1050
- Note:
1051
- This method should be decorated with @hook_tool.
1052
1045
"""
1053
1046
raise NotImplemented
1054
1047
@@ -1068,9 +1061,6 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
1068
1061
1069
1062
Side effect:
1070
1063
Runs the linker to produce the executable.
1071
-
1072
- Note:
1073
- This method should be decorated with @hook_tool.
1074
1064
"""
1075
1065
raise NotImplemented
1076
1066
@@ -1087,9 +1077,6 @@ def archive(self, objects, lib_path):
1087
1077
1088
1078
Side effect:
1089
1079
Runs the archiving tool to produce the library file.
1090
-
1091
- Note:
1092
- This method should be decorated with @hook_tool.
1093
1080
"""
1094
1081
raise NotImplemented
1095
1082
@@ -1107,9 +1094,6 @@ def binary(self, resources, elf, bin):
1107
1094
1108
1095
Side effect:
1109
1096
Runs the elf2bin tool to produce the simplified binary file.
1110
-
1111
- Note:
1112
- This method should be decorated with @hook_tool.
1113
1097
"""
1114
1098
raise NotImplemented
1115
1099
0 commit comments