Merge pull request #10001 from kfnta/psa_release_build_profile

PSA: release.py - add build profile
pull/10012/head
Martin Kojtal 2019-03-08 13:03:33 +01:00 committed by GitHub
commit b582c54a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 10 deletions

View File

@ -62,11 +62,11 @@ def create_mbed_ignore(build_dir):
f.write('*\n') f.write('*\n')
def build_mbed_spm_platform(target, toolchain): def build_mbed_spm_platform(target, toolchain, profile='release'):
subprocess.call([ subprocess.call([
sys.executable, '-u', TEST_PY_LOCATTION, sys.executable, '-u', TEST_PY_LOCATTION,
'--greentea', '--greentea',
'--profile', 'debug', '--profile', profile,
'-t', toolchain, '-t', toolchain,
'-m', target, '-m', target,
'--source', ROOT, '--source', ROOT,
@ -80,7 +80,7 @@ def build_mbed_spm_platform(target, toolchain):
sys.executable, '-u', MAKE_PY_LOCATTION, sys.executable, '-u', MAKE_PY_LOCATTION,
'-t', toolchain, '-t', toolchain,
'-m', target, '-m', target,
'--profile', 'release', '--profile', profile,
'--source', ROOT, '--source', ROOT,
'--build', os.path.join(ROOT, 'BUILD', target), '--build', os.path.join(ROOT, 'BUILD', target),
'--artifact-name', 'psa_release_1.0' '--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]] 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(): for test in TFM_TESTS.keys():
subprocess.call([ subprocess.call([
sys.executable, '-u', TEST_PY_LOCATTION, sys.executable, '-u', TEST_PY_LOCATTION,
'--greentea', '--greentea',
'--profile', 'debug', '--profile', profile,
'-t', toolchain, '-t', toolchain,
'-m', target, '-m', target,
'--source', ROOT, '--source', ROOT,
@ -109,18 +109,19 @@ def build_tfm_platform(target, toolchain):
sys.executable, '-u', MAKE_PY_LOCATTION, sys.executable, '-u', MAKE_PY_LOCATTION,
'-t', toolchain, '-t', toolchain,
'-m', target, '-m', target,
'--profile', 'release', '--profile', profile,
'--source', ROOT, '--source', ROOT,
'--build', os.path.join(ROOT, 'BUILD', target), '--build', os.path.join(ROOT, 'BUILD', target),
'--app-config', TFM_MBED_APP '--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': if _psa_backend(target) is 'TFM':
build_tfm_platform(target, toolchain) build_tfm_platform(target, toolchain, profile)
else: else:
build_mbed_spm_platform(target, toolchain) build_mbed_spm_platform(target, toolchain, profile)
def get_parser(): def get_parser():
@ -130,6 +131,11 @@ def get_parser():
default='*', default='*',
metavar="MCU") metavar="MCU")
parser.add_argument("-d", "--debug",
help="build for the given MCU",
action="store_true",
default=False)
return parser return parser
@ -156,7 +162,7 @@ def main():
target_filter_function = filter_target(options.mcu) target_filter_function = filter_target(options.mcu)
for target, toolchain in filter(target_filter_function, psa_platforms_list): 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__': if __name__ == '__main__':