Change if statements to lookup tables

pull/9480/head
deepikabhavnani 2019-01-25 09:43:03 -06:00
parent f7d49fdc82
commit febbeffff6
1 changed files with 10 additions and 12 deletions

View File

@ -66,20 +66,18 @@ class GCC(mbedToolchain):
"-Wl,--out-implib=%s" % join(build_dir, "cmse_lib.o") "-Wl,--out-implib=%s" % join(build_dir, "cmse_lib.o")
]) ])
if core == "Cortex-M0+": cpu = {
self.cpu = ["-mcpu=cortex-m0plus"] "Cortex-M0+": "cortex-m0plus",
elif core.startswith("Cortex-M4"): "Cortex-M4F": "cortex-m4",
self.cpu = ["-mcpu=cortex-m4"] "Cortex-M7F": "cortex-m7",
elif core.startswith("Cortex-M7"): "Cortex-M7FD": "cortex-m7",
self.cpu = ["-mcpu=cortex-m7"] "Cortex-M33F": "cortex-m33+no_dsp",
elif core == "Cortex-M33FE": "Cortex-M33FE": "cortex-m33"}.get(core, core)
self.cpu = ["-mcpu=cortex-m33"]
elif core == "Cortex-M33F": if core == "Cortex-M33":
self.cpu = ["-mcpu=cortex-m33+nodsp"]
elif core == "Cortex-M33":
self.cpu = ["-march=armv8-m.main"] self.cpu = ["-march=armv8-m.main"]
else: else:
self.cpu = ["-mcpu={}".format(core.lower())] self.cpu = ["-mcpu={}".format(cpu.lower())]
if target.core.startswith("Cortex-M"): if target.core.startswith("Cortex-M"):
self.cpu.append("-mthumb") self.cpu.append("-mthumb")