|
25 | 25 | from shutil import rmtree
|
26 | 26 | from distutils.version import LooseVersion
|
27 | 27 |
|
| 28 | +from tools.targets import CORE_ARCH |
28 | 29 | from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
29 | 30 | from tools.hooks import hook_tool
|
30 | 31 | from tools.utils import mkdir, NotSupportedException, run_cmd
|
@@ -416,27 +417,21 @@ def __init__(self, target, *args, **kwargs):
|
416 | 417 | self.flags['common'].append("-mfpu=fpv5-sp-d16")
|
417 | 418 | self.flags['common'].append("-mfloat-abi=hard")
|
418 | 419 |
|
419 |
| - if ((target.core.startswith("Cortex-M23") or |
420 |
| - target.core.startswith("Cortex-M33")) and |
421 |
| - not target.core.endswith("-NS")): |
422 |
| - self.flags['cxx'].append("-mcmse") |
423 |
| - self.flags['c'].append("-mcmse") |
424 |
| - |
425 |
| - # Create Secure library |
426 |
| - if ((target.core.startswith("Cortex-M23") or |
427 |
| - target.core.startswith("Cortex-M33")) and |
428 |
| - not target.core.endswith("-NS") and |
429 |
| - kwargs.get('build_dir', False)): |
430 |
| - build_dir = kwargs['build_dir'] |
431 |
| - secure_file = join(build_dir, "cmse_lib.o") |
432 |
| - self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file] |
433 |
| - |
434 |
| - # Add linking time preprocessor macro DOMAIN_NS |
435 |
| - if ((target.core.startswith("Cortex-M23") or |
436 |
| - target.core.startswith("Cortex-M33")) and |
437 |
| - target.core.endswith("-NS")): |
438 |
| - define_string = self.make_ld_define("DOMAIN_NS", "0x1") |
439 |
| - self.flags["ld"].append(define_string) |
| 420 | + if CORE_ARCH[target.core] == 8: |
| 421 | + # Add linking time preprocessor macro DOMAIN_NS |
| 422 | + if target.core.endswith("-NS"): |
| 423 | + define_string = self.make_ld_define("DOMAIN_NS", "0x1") |
| 424 | + self.flags["ld"].append(define_string) |
| 425 | + else: |
| 426 | + # Add secure build flag |
| 427 | + self.flags['cxx'].append("-mcmse") |
| 428 | + self.flags['c'].append("-mcmse") |
| 429 | + |
| 430 | + if (not target.core.endswith("-NS")) and kwargs.get('build_dir', False): |
| 431 | + # Create Secure library |
| 432 | + build_dir = kwargs['build_dir'] |
| 433 | + secure_file = join(build_dir, "cmse_lib.o") |
| 434 | + self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file] |
440 | 435 |
|
441 | 436 | asm_cpu = {
|
442 | 437 | "Cortex-M0+": "Cortex-M0",
|
|
0 commit comments