Skip to content

Commit 25a2d15

Browse files
authored
Merge pull request #6487 from theotherjimmy/min-uvision-include
Minimize the size of uvision include paths
2 parents 062164e + c44dba3 commit 25a2d15

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

tools/export/exporters.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,20 @@ def is_target_supported(cls, target_name):
259259
def all_supported_targets(cls):
260260
return [t for t in TARGET_MAP.keys() if cls.is_target_supported(t)]
261261

262+
@staticmethod
263+
def filter_dot(str):
264+
"""
265+
Remove the './' or '.\\' prefix, if present.
266+
"""
267+
if str == None:
268+
return None
269+
if str[:2] == './':
270+
return str[2:]
271+
if str[:2] == '.\\':
272+
return str[2:]
273+
return str
274+
275+
262276

263277
def apply_supported_whitelist(compiler, whitelist, target):
264278
"""Generate a list of supported targets for a given compiler and post-binary hook

tools/export/gnuarmeclipse/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -417,21 +417,6 @@ def compute_exclusions(self):
417417

418418
# -------------------------------------------------------------------------
419419

420-
@staticmethod
421-
def filter_dot(str):
422-
"""
423-
Remove the './' prefix, if present.
424-
This function assumes that resources.win_to_unix()
425-
replaced all windows backslashes with slashes.
426-
"""
427-
if str == None:
428-
return None
429-
if str[:2] == './':
430-
return str[2:]
431-
return str
432-
433-
# -------------------------------------------------------------------------
434-
435420
def dump_tree(self, nodes, depth=0):
436421
for k in nodes.keys():
437422
node = nodes[k]

tools/export/uvision/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def format_flags(self):
178178
template = ["--no_vla", "--cpp", "--c99"]
179179
# Flag is invalid if set in template
180180
# Optimizations are also set in the template
181-
invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x)
181+
invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x)
182182
flags['c_flags'] = [flag.replace('"','\\"') for flag in c_flags if not invalid_flag(flag)]
183183
flags['c_flags'] = " ".join(flags['c_flags'])
184184
flags['ld_flags'] = " ".join(flags['ld_flags'])
@@ -215,7 +215,8 @@ def generate(self):
215215
# UVFile tuples defined above
216216
'project_files': sorted(list(self.format_src(srcs).items()),
217217
key=lambda tuple: tuple[0].lower()),
218-
'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
218+
'include_paths': ';'.join(self.filter_dot(d) for d in
219+
self.resources.inc_dirs).encode('utf-8'),
219220
'device': DeviceUvision(self.target),
220221
}
221222
sct_file = self.resources.linker_script

0 commit comments

Comments
 (0)