Skip to content

Commit 7d0060a

Browse files
authored
Revert "Fix iar exporter - flags duplication and consolidations"
1 parent e6f3187 commit 7d0060a

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

tools/export/iar.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
from tools.export.exporters import Exporter
2222
from tools.targets import TARGET_MAP, TARGET_NAMES
23-
from tools.settings import IAR_PATH
2423

2524
# If you wish to add a new target, add it to project_generator_definitions, and then
2625
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -71,15 +70,6 @@ def generate(self):
7170
project_data['tool_specific']['iar'].setdefault("misc", {})
7271
project_data['tool_specific']['iar'].update(tool_specific['iar'])
7372
project_data['tool_specific']['iar']['misc'].update(self.progen_flags)
74-
# progen does not have common flags, expand c flags by common one
75-
project_data['tool_specific']['iar']['misc']['c_flags'] += self.progen_flags['common_flags']
76-
# template sets full dlib, this would produce the error as it's duplicate
77-
project_data['tool_specific']['iar']['misc']['c_flags'].remove("--dlib_config")
78-
project_data['tool_specific']['iar']['misc']['c_flags'].remove(os.path.join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"))
79-
# these c++ flags are set by template - c++, no rtti, no exceptions
80-
project_data['tool_specific']['iar']['misc']['cxx_flags'].remove("--c++")
81-
project_data['tool_specific']['iar']['misc']['cxx_flags'].remove("--no_rtti")
82-
project_data['tool_specific']['iar']['misc']['cxx_flags'].remove("--no_exceptions")
8373
project_data['common']['build_dir'] = os.path.join(project_data['common']['build_dir'], 'iar_arm')
8474
self.progen_gen_file('iar_arm', project_data)
8575

tools/export/iar_template.ewp.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@
622622
<debug>1</debug>
623623
<option>
624624
<name>OOCOutputFormat</name>
625-
<version>3</version>
626-
<state>3</state>
625+
<version>2</version>
626+
<state>2</state>
627627
</option>
628628
<option>
629629
<name>OCOutputOverride</name>

tools/toolchains/iar.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ class IAR(mbedToolchain):
3838
# Pa093: Implicit conversion from float to integer (ie: wait_ms(85.4) -> wait_ms(85))
3939
# Pa082: Operation involving two values from two registers (ie: (float)(*obj->MR)/(float)(LPC_PWM1->MR0))
4040
"-e", # Enable IAR language extension
41-
"--diag_suppress=Pa050,Pa084,Pa093,Pa082",
42-
"--thumb",
43-
"--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h")],
41+
"--diag_suppress=Pa050,Pa084,Pa093,Pa082"],
4442
'asm': [],
45-
'c': [],
43+
'c': ["--vla"],
4644
'cxx': ["--c++", "--no_rtti", "--no_exceptions", "--guard_calls"],
4745
'ld': ["--skip_dynamic_initialization", "--threaded_lib"],
4846
}
@@ -53,31 +51,35 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
5351
cpuchoice = "Cortex-M7"
5452
else:
5553
cpuchoice = target.core
54+
self.flags["common"] += [
55+
"--cpu=%s" % cpuchoice, "--thumb",
56+
"--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
57+
]
5658

5759
if target.core == "Cortex-M7F":
5860
self.flags["common"].append("--fpu=VFPv5_sp")
5961

60-
optimization = []
6162
if "debug-info" in self.options:
62-
optimization.append("-r")
63-
optimization.append("-On")
63+
self.flags["common"].append("-r")
64+
self.flags["common"].append("-On")
6465
else:
65-
optimization.append("-Oh")
66+
self.flags["common"].append("-Oh")
6667

6768
IAR_BIN = join(IAR_PATH, "bin")
6869
main_cc = join(IAR_BIN, "iccarm")
6970

71+
self.flags["asm"] += ["--cpu", cpuchoice]
7072
if target.core == "Cortex-M7F":
7173
self.flags["asm"] += ["--fpu", "VFPv5_sp"]
72-
self.asm = [join(IAR_BIN, "iasmarm")] + self.flags["asm"] + ["--cpu=%s" % cpuchoice]
74+
self.asm = [join(IAR_BIN, "iasmarm")] + self.flags["asm"]
7375
if not "analyze" in self.options:
7476
self.cc = [main_cc]
7577
self.cppc = [main_cc]
7678
else:
7779
self.cc = [join(GOANNA_PATH, "goannacc"), '--with-cc="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT]
7880
self.cppc = [join(GOANNA_PATH, "goannac++"), '--with-cxx="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT]
79-
self.cc += self.flags["common"] + self.flags["c"] + ["--cpu=%s" % cpuchoice] + optimization
80-
self.cppc += self.flags["common"] + self.flags["cxx"] + ["--cpu=%s" % cpuchoice] + optimization
81+
self.cc += self.flags["common"] + self.flags["c"]
82+
self.cppc += self.flags["common"] + self.flags["cxx"]
8183
self.ld = join(IAR_BIN, "ilinkarm")
8284
self.ar = join(IAR_BIN, "iarchive")
8385
self.elf2bin = join(IAR_BIN, "ielftool")

0 commit comments

Comments
 (0)