Skip to content

Commit b582c54

Browse files
authored
Merge pull request #10001 from kfnta/psa_release_build_profile
PSA: release.py - add build profile
2 parents 7d9c633 + 9a3ab49 commit b582c54

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tools/psa/release.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def create_mbed_ignore(build_dir):
6262
f.write('*\n')
6363

6464

65-
def build_mbed_spm_platform(target, toolchain):
65+
def build_mbed_spm_platform(target, toolchain, profile='release'):
6666
subprocess.call([
6767
sys.executable, '-u', TEST_PY_LOCATTION,
6868
'--greentea',
69-
'--profile', 'debug',
69+
'--profile', profile,
7070
'-t', toolchain,
7171
'-m', target,
7272
'--source', ROOT,
@@ -80,7 +80,7 @@ def build_mbed_spm_platform(target, toolchain):
8080
sys.executable, '-u', MAKE_PY_LOCATTION,
8181
'-t', toolchain,
8282
'-m', target,
83-
'--profile', 'release',
83+
'--profile', profile,
8484
'--source', ROOT,
8585
'--build', os.path.join(ROOT, 'BUILD', target),
8686
'--artifact-name', 'psa_release_1.0'
@@ -91,12 +91,12 @@ def _tfm_test_defines(test):
9191
return ['-D{}'.format(define) for define in TFM_TESTS[test]]
9292

9393

94-
def build_tfm_platform(target, toolchain):
94+
def build_tfm_platform(target, toolchain, profile='release'):
9595
for test in TFM_TESTS.keys():
9696
subprocess.call([
9797
sys.executable, '-u', TEST_PY_LOCATTION,
9898
'--greentea',
99-
'--profile', 'debug',
99+
'--profile', profile,
100100
'-t', toolchain,
101101
'-m', target,
102102
'--source', ROOT,
@@ -109,18 +109,19 @@ def build_tfm_platform(target, toolchain):
109109
sys.executable, '-u', MAKE_PY_LOCATTION,
110110
'-t', toolchain,
111111
'-m', target,
112-
'--profile', 'release',
112+
'--profile', profile,
113113
'--source', ROOT,
114114
'--build', os.path.join(ROOT, 'BUILD', target),
115115
'--app-config', TFM_MBED_APP
116116
])
117117

118118

119-
def build_psa_platform(target, toolchain):
119+
def build_psa_platform(target, toolchain, debug=False):
120+
profile = 'debug' if debug else 'release'
120121
if _psa_backend(target) is 'TFM':
121-
build_tfm_platform(target, toolchain)
122+
build_tfm_platform(target, toolchain, profile)
122123
else:
123-
build_mbed_spm_platform(target, toolchain)
124+
build_mbed_spm_platform(target, toolchain, profile)
124125

125126

126127
def get_parser():
@@ -130,6 +131,11 @@ def get_parser():
130131
default='*',
131132
metavar="MCU")
132133

134+
parser.add_argument("-d", "--debug",
135+
help="build for the given MCU",
136+
action="store_true",
137+
default=False)
138+
133139
return parser
134140

135141

@@ -156,7 +162,7 @@ def main():
156162
target_filter_function = filter_target(options.mcu)
157163

158164
for target, toolchain in filter(target_filter_function, psa_platforms_list):
159-
build_psa_platform(target, toolchain)
165+
build_psa_platform(target, toolchain, options.debug)
160166

161167

162168
if __name__ == '__main__':

0 commit comments

Comments
 (0)