Skip to content

Commit c29207a

Browse files
committed
Correct gcc m33 floating point handling
1 parent ccff46d commit c29207a

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
@@ -49,21 +49,20 @@ def __init__(self, target, notify=None, macros=None,
4949
self.flags["ld"].append("--specs=nano.specs")
5050

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

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

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

89-
if target.core == "Cortex-M23" or target.core == "Cortex-M33":
88+
if ((target.core.startswith("Cortex-M23") or
89+
target.core.startswith("Cortex-M33")) and
90+
not target.core.endswith("-NS")):
9091
self.cpu.append("-mcmse")
9192

9293
self.flags["common"] += self.cpu

0 commit comments

Comments
 (0)