Skip to content

Commit b84627f

Browse files
authored
Merge pull request #6146 from theotherjimmy/fix-m33-fp
Correct gcc m33 floating point handling
2 parents 1d3e59a + c29207a commit b84627f

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

tools/toolchains/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,10 @@ class mbedToolchain:
337337
"Cortex-A9" : ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT", "__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"],
338338
"Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__DOMAIN_NS=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
339339
"Cortex-M23": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
340-
"Cortex-M33-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
341-
"Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
340+
"Cortex-M33-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
341+
"Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
342+
"Cortex-M33F-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
343+
"Cortex-M33F": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
342344
}
343345

344346
MBED_CONFIG_FILE_NAME="mbed_config.h"

tools/toolchains/gcc.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,20 @@ def __init__(self, target, notify=None, macros=None,
4848
self.flags["ld"].append("--specs=nano.specs")
4949

5050
if target.core == "Cortex-M0+":
51-
cpu = "cortex-m0plus"
52-
elif target.core == "Cortex-M4F":
53-
cpu = "cortex-m4"
54-
elif target.core == "Cortex-M7F":
55-
cpu = "cortex-m7"
56-
elif target.core == "Cortex-M7FD":
57-
cpu = "cortex-m7"
58-
elif target.core == "Cortex-M23-NS":
59-
cpu = "cortex-m23"
60-
elif target.core == "Cortex-M33-NS":
61-
cpu = "cortex-m33"
51+
self.cpu = ["-mcpu=cortex-m0plus"]
52+
elif target.core.startswith("Cortex-M4"):
53+
self.cpu = ["-mcpu=cortex-m4"]
54+
elif target.core.startswith("Cortex-M7"):
55+
self.cpu = ["-mcpu=cortex-m7"]
56+
elif target.core.startswith("Cortex-M23"):
57+
self.cpu = ["-mcpu=cortex-m23"]
58+
elif target.core.startswith("Cortex-M33F"):
59+
self.cpu = ["-mcpu=cortex-m33"]
60+
elif target.core.startswith("Cortex-M33"):
61+
self.cpu = ["-march=armv8-m.main"]
6262
else:
63-
cpu = target.core.lower()
63+
self.cpu = ["-mcpu={}".format(target.core.lower())]
6464

65-
self.cpu = ["-mcpu=%s" % cpu]
6665
if target.core.startswith("Cortex-M"):
6766
self.cpu.append("-mthumb")
6867

@@ -85,7 +84,9 @@ def __init__(self, target, notify=None, macros=None,
8584
self.cpu.append("-mfloat-abi=hard")
8685
self.cpu.append("-mno-unaligned-access")
8786

88-
if target.core == "Cortex-M23" or target.core == "Cortex-M33":
87+
if ((target.core.startswith("Cortex-M23") or
88+
target.core.startswith("Cortex-M33")) and
89+
not target.core.endswith("-NS")):
8990
self.cpu.append("-mcmse")
9091
elif target.core == "Cortex-M23-NS" or target.core == "Cortex-M33-NS":
9192
self.flags["ld"].append("-D__DOMAIN_NS=1")

0 commit comments

Comments
 (0)