From 9a3ab4983ea9f846477b91374a1276c2a236238c Mon Sep 17 00:00:00 2001 From: Oren Cohen Date: Thu, 7 Mar 2019 23:54:15 +0200 Subject: [PATCH] Add build profile option Default set to release --- tools/psa/release.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tools/psa/release.py b/tools/psa/release.py index 19ec7b80dd9..ebd1777a11a 100644 --- a/tools/psa/release.py +++ b/tools/psa/release.py @@ -62,11 +62,11 @@ def create_mbed_ignore(build_dir): f.write('*\n') -def build_mbed_spm_platform(target, toolchain): +def build_mbed_spm_platform(target, toolchain, profile='release'): subprocess.call([ sys.executable, '-u', TEST_PY_LOCATTION, '--greentea', - '--profile', 'debug', + '--profile', profile, '-t', toolchain, '-m', target, '--source', ROOT, @@ -80,7 +80,7 @@ def build_mbed_spm_platform(target, toolchain): sys.executable, '-u', MAKE_PY_LOCATTION, '-t', toolchain, '-m', target, - '--profile', 'release', + '--profile', profile, '--source', ROOT, '--build', os.path.join(ROOT, 'BUILD', target), '--artifact-name', 'psa_release_1.0' @@ -91,12 +91,12 @@ def _tfm_test_defines(test): return ['-D{}'.format(define) for define in TFM_TESTS[test]] -def build_tfm_platform(target, toolchain): +def build_tfm_platform(target, toolchain, profile='release'): for test in TFM_TESTS.keys(): subprocess.call([ sys.executable, '-u', TEST_PY_LOCATTION, '--greentea', - '--profile', 'debug', + '--profile', profile, '-t', toolchain, '-m', target, '--source', ROOT, @@ -109,18 +109,19 @@ def build_tfm_platform(target, toolchain): sys.executable, '-u', MAKE_PY_LOCATTION, '-t', toolchain, '-m', target, - '--profile', 'release', + '--profile', profile, '--source', ROOT, '--build', os.path.join(ROOT, 'BUILD', target), '--app-config', TFM_MBED_APP ]) -def build_psa_platform(target, toolchain): +def build_psa_platform(target, toolchain, debug=False): + profile = 'debug' if debug else 'release' if _psa_backend(target) is 'TFM': - build_tfm_platform(target, toolchain) + build_tfm_platform(target, toolchain, profile) else: - build_mbed_spm_platform(target, toolchain) + build_mbed_spm_platform(target, toolchain, profile) def get_parser(): @@ -130,6 +131,11 @@ def get_parser(): default='*', metavar="MCU") + parser.add_argument("-d", "--debug", + help="build for the given MCU", + action="store_true", + default=False) + return parser @@ -156,7 +162,7 @@ def main(): target_filter_function = filter_target(options.mcu) for target, toolchain in filter(target_filter_function, psa_platforms_list): - build_psa_platform(target, toolchain) + build_psa_platform(target, toolchain, options.debug) if __name__ == '__main__':