Skip to content

Commit

Permalink
Add core option for Cortex-M33 with DSP enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Deepika Bhavnani <Deepika.Bhavnani@arm.com>
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
  • Loading branch information
deepikabhavnani authored and mmahadevan108 committed Dec 7, 2018
1 parent 54f53e0 commit f05e7b7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
6 changes: 5 additions & 1 deletion tools/targets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -71,6 +73,8 @@
"Cortex-M33F": 8,
"Cortex-M33-NS": 8,
"Cortex-M33F-NS": 8,
"Cortex-M33FD": 8,
"Cortex-M33FD-NS": 8,
}

################################################################################
Expand Down
24 changes: 18 additions & 6 deletions tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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)

Expand Down
13 changes: 11 additions & 2 deletions tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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")
Expand All @@ -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

Expand Down

0 comments on commit f05e7b7

Please sign in to comment.