|
25 | 25 | from shutil import rmtree
|
26 | 26 | from distutils.version import LooseVersion
|
27 | 27 |
|
28 |
| -from tools.targets import CORE_ARCH |
29 | 28 | from tools.toolchains.mbed_toolchain import mbedToolchain, TOOLCHAIN_PATHS
|
30 | 29 | from tools.utils import mkdir, NotSupportedException, run_cmd
|
31 | 30 | from tools.resources import FileRef
|
@@ -521,25 +520,25 @@ def __init__(self, target, *args, **kwargs):
|
521 | 520 | if "--library_type=microlib" not in self.flags['asm']:
|
522 | 521 | self.flags['asm'].append("--library_type=microlib")
|
523 | 522 |
|
524 |
| - core = target.core |
525 |
| - if CORE_ARCH[target.core] == 8: |
526 |
| - if ((not target.core.endswith("-NS")) and |
527 |
| - kwargs.get('build_dir', False)): |
528 |
| - # Create Secure library |
| 523 | + if target.is_TrustZone_secure_target: |
| 524 | + if kwargs.get('build_dir', False): |
| 525 | + # Output secure import library |
529 | 526 | build_dir = kwargs['build_dir']
|
530 | 527 | secure_file = join(build_dir, "cmse_lib.o")
|
531 | 528 | self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]
|
532 | 529 |
|
| 530 | + # Enable compiler security extensions |
| 531 | + self.flags['cxx'].append("-mcmse") |
| 532 | + self.flags['c'].append("-mcmse") |
| 533 | + |
| 534 | + if target.is_TrustZone_non_secure_target: |
533 | 535 | # Add linking time preprocessor macro DOMAIN_NS
|
534 |
| - if target.core.endswith("-NS"): |
535 |
| - define_string = self.make_ld_define("DOMAIN_NS", "0x1") |
536 |
| - self.flags["ld"].append(define_string) |
537 |
| - core = target.core[:-3] |
538 |
| - else: |
539 |
| - # Add secure build flag |
540 |
| - self.flags['cxx'].append("-mcmse") |
541 |
| - self.flags['c'].append("-mcmse") |
| 536 | + # (DOMAIN_NS is passed to compiler and assembler via CORTEX_SYMBOLS |
| 537 | + # in mbedToolchain.get_symbols) |
| 538 | + define_string = self.make_ld_define("DOMAIN_NS", "0x1") |
| 539 | + self.flags["ld"].append(define_string) |
542 | 540 |
|
| 541 | + core = target.core_without_NS |
543 | 542 | cpu = {
|
544 | 543 | "Cortex-M0+": "cortex-m0plus",
|
545 | 544 | "Cortex-M4F": "cortex-m4",
|
|
0 commit comments