diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index 2a63068b79..d5e810879a 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -335,8 +335,10 @@ class mbedToolchain: "Cortex-A9" : ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT", "__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"], "Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__DOMAIN_NS=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-M23": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M33-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M33-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M33F-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__DOMAIN_NS=1", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M33F": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__FPU_PRESENT", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], } MBED_CONFIG_FILE_NAME="mbed_config.h" diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index 2543f4a89e..3a7f8356ce 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -48,21 +48,20 @@ class GCC(mbedToolchain): self.flags["ld"].append("--specs=nano.specs") if target.core == "Cortex-M0+": - cpu = "cortex-m0plus" - elif target.core == "Cortex-M4F": - cpu = "cortex-m4" - elif target.core == "Cortex-M7F": - cpu = "cortex-m7" - elif target.core == "Cortex-M7FD": - cpu = "cortex-m7" - elif target.core == "Cortex-M23-NS": - cpu = "cortex-m23" - elif target.core == "Cortex-M33-NS": - cpu = "cortex-m33" + self.cpu = ["-mcpu=cortex-m0plus"] + elif target.core.startswith("Cortex-M4"): + self.cpu = ["-mcpu=cortex-m4"] + elif target.core.startswith("Cortex-M7"): + self.cpu = ["-mcpu=cortex-m7"] + elif target.core.startswith("Cortex-M23"): + self.cpu = ["-mcpu=cortex-m23"] + elif target.core.startswith("Cortex-M33F"): + self.cpu = ["-mcpu=cortex-m33"] + elif target.core.startswith("Cortex-M33"): + self.cpu = ["-march=armv8-m.main"] else: - cpu = target.core.lower() + self.cpu = ["-mcpu={}".format(target.core.lower())] - self.cpu = ["-mcpu=%s" % cpu] if target.core.startswith("Cortex-M"): self.cpu.append("-mthumb") @@ -85,7 +84,9 @@ class GCC(mbedToolchain): self.cpu.append("-mfloat-abi=hard") self.cpu.append("-mno-unaligned-access") - 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.cpu.append("-mcmse") elif target.core == "Cortex-M23-NS" or target.core == "Cortex-M33-NS": self.flags["ld"].append("-D__DOMAIN_NS=1")