From f05e7b77d09b04cdeb2c1ef7c761f79240e0abc0 Mon Sep 17 00:00:00 2001 From: deepikabhavnani Date: Thu, 6 Dec 2018 11:33:10 -0600 Subject: [PATCH] Add core option for Cortex-M33 with DSP enabled Signed-off-by: Deepika Bhavnani Signed-off-by: Mahesh Mahadevan --- tools/targets/__init__.py | 6 +++++- tools/toolchains/arm.py | 24 ++++++++++++++++++------ tools/toolchains/gcc.py | 13 +++++++++++-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/tools/targets/__init__.py b/tools/targets/__init__.py index 42b64948bbb..48a24e9eca3 100644 --- a/tools/targets/__init__.py +++ b/tools/targets/__init__.py @@ -51,7 +51,9 @@ "Cortex-M33": ["M33", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"], "Cortex-M33-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"], "Cortex-M33F": ["M33", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"], - "Cortex-M33F-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"] + "Cortex-M33F-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"], + "Cortex-M33FD": ["M33", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"], + "Cortex-M33FD-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"] } CORE_ARCH = { @@ -71,6 +73,8 @@ "Cortex-M33F": 8, "Cortex-M33-NS": 8, "Cortex-M33F-NS": 8, + "Cortex-M33FD": 8, + "Cortex-M33FD-NS": 8, } ################################################################################ diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 2d16e7c3490..d02c1842267 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -166,7 +166,7 @@ def parse_output(self, output): msg = None else: msg['text'] += line+"\n" - + if msg is not None: self.notify.cc_info(msg) @@ -304,7 +304,7 @@ def archive(self, objects, lib_path): @hook_tool def binary(self, resources, elf, bin): _, fmt = splitext(bin) - # On .hex format, combine multiple .hex files (for multiple load regions) into one + # On .hex format, combine multiple .hex files (for multiple load regions) into one bin_arg = {".bin": "--bin", ".hex": "--i32combined"}[fmt] cmd = [self.elf2bin, bin_arg, '-o', bin, elf] cmd = self.hook.get_cmdline_binary(cmd) @@ -364,7 +364,8 @@ class ARMC6(ARM_STD): SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4", "Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-M23", "Cortex-M23-NS", "Cortex-M33", "Cortex-M33F", - "Cortex-M33-NS", "Cortex-M33F-NS", "Cortex-A9"] + "Cortex-M33-NS", "Cortex-M33F-NS", "Cortex-M33FD-NS", "Cortex-M33FD", + "Cortex-A9"] ARMCC_RANGE = (LooseVersion("6.10"), LooseVersion("7.0")) @staticmethod @@ -392,6 +393,10 @@ def __init__(self, target, *args, **kwargs): self.flags['common'].append("-mcpu=%s" % target.core.lower()[:-2]) self.flags['ld'].append("--cpu=%s" % target.core.lower()[:-2]) self.SHEBANG += " -mcpu=%s" % target.core.lower()[:-2] + elif target.core.lower().endswith("fd-ns"): + self.flags['common'].append("-mcpu=%s" % target.core.lower()[:-5]) + self.flags['ld'].append("--cpu=%s" % target.core.lower()[:-5]) + self.SHEBANG += " -mcpu=%s" % target.core.lower()[:-5] elif target.core.lower().endswith("f"): self.flags['common'].append("-mcpu=%s" % target.core.lower()[:-1]) self.flags['ld'].append("--cpu=%s" % target.core.lower()[:-1]) @@ -420,18 +425,25 @@ def __init__(self, target, *args, **kwargs): self.flags['common'].append("-mfpu=fpv5-sp-d16") self.flags['common'].append("-mfloat-abi=softfp") - if target.core == "Cortex-M23" or target.core == "Cortex-M33": + if ((target.core.startswith("Cortex-M23") or + target.core.startswith("Cortex-M33")) and + not target.core.endswith("-NS")): self.flags['cxx'].append("-mcmse") self.flags['c'].append("-mcmse") # Create Secure library - if ((target.core == "Cortex-M23" or self.target.core == "Cortex-M33") and + if ((target.core.startswith("Cortex-M23") or + target.core.startswith("Cortex-M33")) and + not target.core.endswith("-NS") and kwargs.get('build_dir', False)): build_dir = kwargs['build_dir'] secure_file = join(build_dir, "cmse_lib.o") self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file] + # Add linking time preprocessor macro DOMAIN_NS - if target.core == "Cortex-M23-NS" or self.target.core == "Cortex-M33-NS": + if ((target.core.startswith("Cortex-M23") or + target.core.startswith("Cortex-M33")) and + target.core.endswith("-NS")): define_string = self.make_ld_define("DOMAIN_NS", "0x1") self.flags["ld"].append(define_string) diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index 1a48bb0408a..af3c5ca6aa3 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -60,6 +60,8 @@ def __init__(self, target, notify=None, macros=None, build_profile=None, self.cpu = ["-mcpu=cortex-m7"] elif target.core.startswith("Cortex-M23"): self.cpu = ["-mcpu=cortex-m23"] + elif target.core.startswith("Cortex-M33FD"): + self.cpu = ["-mcpu=cortex-m33"] elif target.core.startswith("Cortex-M33F"): self.cpu = ["-mcpu=cortex-m33+nodsp"] elif target.core.startswith("Cortex-M33"): @@ -80,6 +82,9 @@ def __init__(self, target, notify=None, macros=None, build_profile=None, elif target.core == "Cortex-M7FD": self.cpu.append("-mfpu=fpv5-d16") self.cpu.append("-mfloat-abi=softfp") + elif target.core.startswith("Cortex-M33F"): + self.cpu.append("-mfpu=fpv5-sp-d16") + self.cpu.append("-mfloat-abi=softfp") if target.core == "Cortex-A9": self.cpu.append("-mthumb-interwork") @@ -97,8 +102,12 @@ def __init__(self, target, notify=None, macros=None, build_profile=None, "-Wl,--cmse-implib", "-Wl,--out-implib=%s" % join(build_dir, "cmse_lib.o") ]) - elif target.core == "Cortex-M23-NS" or target.core == "Cortex-M33-NS" or target.core == "Cortex-M33F-NS": - self.flags["ld"].append("-DDOMAIN_NS=1") + + # Add linking time preprocessor macro DOMAIN_NS + if ((target.core.startswith("Cortex-M23") or + target.core.startswith("Cortex-M33")) and + target.core.endswith("-NS")): + self.flags["ld"].append("-DDOMAIN_NS=1") self.flags["common"] += self.cpu