@@ -383,7 +383,10 @@ def configure_options(target):
383383
384384 disable_spm = False
385385
386- for config in options :
386+ individual_options = [x for x in options if x .startswith ("MBEDTLS_" ) or x .startswith ("-MBEDTLS_" ) or x .startswith ("PSA_" ) or x .startswith ("-PSA_" )]
387+ bulk_options = [x for x in options if x not in individual_options ]
388+
389+ for config in bulk_options :
387390 if config .endswith (".h" ):
388391 # a config file - overwrite existing config file
389392 path = config if os .path .exists (config ) else f"{ ROOT } /configs/{ config } "
@@ -403,18 +406,19 @@ def configure_options(target):
403406 else :
404407 log (f"cp { path [len (ROOT ) + 1 :] if path .startswith (ROOT ) else path } { dest [len (ROOT ) + 1 :]} " )
405408 shutil .copy (path , dest )
406- elif config .startswith ("MBEDTLS_" ) or config .startswith ("-MBEDTLS_" ) or config .startswith ("PSA_" ) or config .startswith ("-PSA_" ):
407- # an individual option like MBEDTLS_XYZ or -PSA_XYZ
408- action = "set"
409- if config .startswith ("-" ):
410- action = "unset"
411- config = config [1 :]
412- set_config_option (action , config , silent = False )
413409 else :
414410 # a configuration recognised by config.py, e.g. "baremetal"
415411 log (f"scripts/config.py { config } " )
416412 subrun ([f"{ ROOT } /scripts/config.py" , config ], silent = True )
417413
414+ for config in individual_options :
415+ # an individual option like MBEDTLS_XYZ or -PSA_XYZ
416+ action = "set"
417+ if config .startswith ("-" ):
418+ action = "unset"
419+ config = config [1 :]
420+ set_config_option (action , config , silent = False )
421+
418422 if disable_spm :
419423 # at some point in the past, MBEDTLS_HAVE_ASM also needs disabling,
420424 # and more options again (not sure which) for 3.0.0
@@ -601,7 +605,8 @@ mtest -k alignment
601605
602606Report library size, as built by armclang -Oz with TF-M configuration for armv8 thumb2:
603607mtest -S
604- mtest -S clang # as above, but use clang instead of the default armclang
608+ mtest -S clang # as above, but use clang instead of the default armclang
609+ mtest -S MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED # as above, but modify TF-M config with given option(s)
605610
606611Build aes.o multiple times, with every combination of the given options:
607612mtest aes.o MBEDTLS_AES_SETKEY_ENC_ALT,MBEDTLS_AES_DECRYPT_ALT,MBEDTLS_AES_ROM_TABLES,MBEDTLS_AES_ENCRYPT_ALT,MBEDTLS_AES_SETKEY_DEC_ALT,MBEDTLS_AES_FEWER_TABLES,MBEDTLS_PADLOCK_C
0 commit comments