Skip to content

Commit c472005

Browse files
author
deepikabhavnani
committed
GCC_ARM: Strip the -NS from core option before setting floating point options
1 parent c0750de commit c472005

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tools/toolchains/gcc.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,37 +53,48 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
5353
self.flags["common"].append("-DMBED_RTOS_SINGLE_THREAD")
5454
self.flags["ld"].append("--specs=nano.specs")
5555

56-
if target.core == "Cortex-M0+":
56+
core = target.core
57+
if CORE_ARCH[target.core] == 8:
58+
# Add linking time preprocessor macro DOMAIN_NS
59+
if target.core.endswith("-NS"):
60+
self.flags["ld"].append("-DDOMAIN_NS=1")
61+
core = target.core[:-3]
62+
else:
63+
self.cpu.append("-mcmse")
64+
self.flags["ld"].extend([
65+
"-Wl,--cmse-implib",
66+
"-Wl,--out-implib=%s" % join(build_dir, "cmse_lib.o")
67+
])
68+
69+
if core == "Cortex-M0+":
5770
self.cpu = ["-mcpu=cortex-m0plus"]
58-
elif target.core.startswith("Cortex-M4"):
71+
elif core.startswith("Cortex-M4"):
5972
self.cpu = ["-mcpu=cortex-m4"]
60-
elif target.core.startswith("Cortex-M7"):
73+
elif core.startswith("Cortex-M7"):
6174
self.cpu = ["-mcpu=cortex-m7"]
62-
elif target.core.startswith("Cortex-M23"):
63-
self.cpu = ["-mcpu=cortex-m23"]
64-
elif target.core.startswith("Cortex-M33FD"):
75+
elif core == "Cortex-M33FD":
6576
self.cpu = ["-mcpu=cortex-m33"]
66-
elif target.core.startswith("Cortex-M33F"):
77+
elif core == "Cortex-M33F":
6778
self.cpu = ["-mcpu=cortex-m33+nodsp"]
68-
elif target.core.startswith("Cortex-M33"):
79+
elif core == "Cortex-M33":
6980
self.cpu = ["-march=armv8-m.main"]
7081
else:
71-
self.cpu = ["-mcpu={}".format(target.core.lower())]
82+
self.cpu = ["-mcpu={}".format(core.lower())]
7283

7384
if target.core.startswith("Cortex-M"):
7485
self.cpu.append("-mthumb")
7586

7687
# FPU handling, M7 possibly to have double FPU
77-
if target.core == "Cortex-M4F":
88+
if core == "Cortex-M4F":
7889
self.cpu.append("-mfpu=fpv4-sp-d16")
7990
self.cpu.append("-mfloat-abi=softfp")
80-
elif target.core == "Cortex-M7F":
91+
elif core == "Cortex-M7F":
8192
self.cpu.append("-mfpu=fpv5-sp-d16")
8293
self.cpu.append("-mfloat-abi=softfp")
83-
elif target.core == "Cortex-M7FD":
94+
elif core == "Cortex-M7FD":
8495
self.cpu.append("-mfpu=fpv5-d16")
8596
self.cpu.append("-mfloat-abi=softfp")
86-
elif target.core.startswith("Cortex-M33F"):
97+
elif core.startswith("Cortex-M33F"):
8798
self.cpu.append("-mfpu=fpv5-sp-d16")
8899
self.cpu.append("-mfloat-abi=softfp")
89100

@@ -95,17 +106,6 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
95106
self.cpu.append("-mfloat-abi=hard")
96107
self.cpu.append("-mno-unaligned-access")
97108

98-
if CORE_ARCH[target.core] == 8:
99-
# Add linking time preprocessor macro DOMAIN_NS
100-
if target.core.endswith("-NS"):
101-
self.flags["ld"].append("-DDOMAIN_NS=1")
102-
else:
103-
self.cpu.append("-mcmse")
104-
self.flags["ld"].extend([
105-
"-Wl,--cmse-implib",
106-
"-Wl,--out-implib=%s" % join(build_dir, "cmse_lib.o")
107-
])
108-
109109
self.flags["common"] += self.cpu
110110

111111
main_cc = join(tool_path, "arm-none-eabi-gcc")

0 commit comments

Comments
 (0)