@@ -45,11 +45,15 @@ def get_mbed_official_psa_release():
45
45
psa_targets_release_list = []
46
46
psa_secure_targets = [t for t in TARGET_NAMES if Target .get_target (t ).is_PSA_secure_target ]
47
47
for t in psa_secure_targets :
48
+ delivery_dir = os .path .join (ROOT , 'targets' , TARGET_MAP [t ].delivery_dir )
49
+ if not os .path .exists (delivery_dir ):
50
+ raise Exception ("{} does not have delivery_dir" .format (TARGET_MAP [t ].name ))
48
51
psa_targets_release_list .append (
49
52
tuple (
50
53
[
51
54
TARGET_MAP [t ].name ,
52
- TARGET_MAP [t ].default_toolchain
55
+ TARGET_MAP [t ].default_toolchain ,
56
+ delivery_dir ,
53
57
]
54
58
)
55
59
)
@@ -116,13 +120,35 @@ def build_tfm_platform(target, toolchain, profile='release'):
116
120
])
117
121
118
122
119
- def build_psa_platform (target , toolchain , debug = False ):
123
+ def commit_biannries (target , delivery_dir ):
124
+ cmd = [
125
+ 'git' ,
126
+ '-C' , ROOT ,
127
+ 'add' , os .path .relpath (delivery_dir , ROOT )
128
+ ]
129
+
130
+ subprocess .call (cmd )
131
+ commit_message = 'Update secure binaries for {}' .format (target )
132
+ cmd = [
133
+ 'git' ,
134
+ '-C' , ROOT ,
135
+ 'commit' ,
136
+ '-m' , commit_message
137
+ ]
138
+
139
+ subprocess .call (cmd )
140
+
141
+
142
+ def build_psa_platform (target , toolchain , delivery_dir , debug = False , git_commit = False ):
120
143
profile = 'debug' if debug else 'release'
121
144
if _psa_backend (target ) is 'TFM' :
122
145
build_tfm_platform (target , toolchain , profile )
123
146
else :
124
147
build_mbed_spm_platform (target , toolchain , profile )
125
148
149
+ if git_commit :
150
+ commit_biannries (target , delivery_dir )
151
+
126
152
127
153
def get_parser ():
128
154
parser = ArgumentParser ()
@@ -136,6 +162,11 @@ def get_parser():
136
162
action = "store_true" ,
137
163
default = False )
138
164
165
+ parser .add_argument ("--commit" ,
166
+ help = "create a git commit for each platform" ,
167
+ action = "store_true" ,
168
+ default = False )
169
+
139
170
return parser
140
171
141
172
@@ -161,8 +192,8 @@ def main():
161
192
if options .mcu is not '*' :
162
193
target_filter_function = filter_target (options .mcu )
163
194
164
- for target , toolchain in filter (target_filter_function , psa_platforms_list ):
165
- build_psa_platform (target , toolchain , options .debug )
195
+ for target , toolchain , delivery_dir in filter (target_filter_function , psa_platforms_list ):
196
+ build_psa_platform (target , toolchain , delivery_dir , options .debug , options . commit )
166
197
167
198
168
199
if __name__ == '__main__' :
0 commit comments