From 434c35c1d597f05c3939363d95c579d950750ef4 Mon Sep 17 00:00:00 2001 From: Joris Aerts Date: Wed, 18 Sep 2013 10:02:40 -0700 Subject: [PATCH] Split uVision project source files in groups mbed/hal/src Files are grouped based on their path (mbed/common, mbed/targets, *) Empty folders are not exported. Modified all uVision templates accordingly. --- workspace_tools/export/uvision4.py | 19 ++++++++++++++----- .../export/uvision4_kl25z.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc1114.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc11u24.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc1347.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc1768.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc4088.uvproj.tmpl | 6 ++++-- .../export/uvision4_lpc812.uvproj.tmpl | 6 ++++-- 8 files changed, 42 insertions(+), 19 deletions(-) diff --git a/workspace_tools/export/uvision4.py b/workspace_tools/export/uvision4.py index 8525989f50..b32b4ddd93 100644 --- a/workspace_tools/export/uvision4.py +++ b/workspace_tools/export/uvision4.py @@ -37,18 +37,27 @@ class Uvision4(Exporter): return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM' def generate(self): - source_files = [] + source_files = { + 'mbed': [], + 'hal': [], + 'src': [] + } for r_type, n in Uvision4.FILE_TYPES.iteritems(): for file in getattr(self.resources, r_type): - source_files.append({ - 'name': basename(file), 'type': n, 'path': file - }) + f = {'name': basename(file), 'type': n, 'path': file} + if file.startswith("mbed\\common"): + source_files['mbed'].append(f) + elif file.startswith("mbed\\targets"): + source_files['hal'].append(f) + else: + source_files['src'].append(f) + source_files = dict( [(k,v) for k,v in source_files.items() if len(v)>0]) ctx = { 'name': self.program_name, 'include_paths': self.resources.inc_dirs, 'scatter_file': self.resources.linker_script, 'object_files': self.resources.objects + self.resources.libraries, - 'source_files': source_files, + 'source_files': source_files.items(), 'symbols': self.toolchain.get_symbols() } target = self.target.lower() diff --git a/workspace_tools/export/uvision4_kl25z.uvproj.tmpl b/workspace_tools/export/uvision4_kl25z.uvproj.tmpl index 90964b490e..ac92ccc25e 100644 --- a/workspace_tools/export/uvision4_kl25z.uvproj.tmpl +++ b/workspace_tools/export/uvision4_kl25z.uvproj.tmpl @@ -391,10 +391,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -414,6 +415,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc1114.uvproj.tmpl b/workspace_tools/export/uvision4_lpc1114.uvproj.tmpl index 713c9299f3..deb5360641 100644 --- a/workspace_tools/export/uvision4_lpc1114.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc1114.uvproj.tmpl @@ -393,10 +393,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -416,6 +417,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc11u24.uvproj.tmpl b/workspace_tools/export/uvision4_lpc11u24.uvproj.tmpl index 26468dd776..a775c8b9a1 100644 --- a/workspace_tools/export/uvision4_lpc11u24.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc11u24.uvproj.tmpl @@ -387,10 +387,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -410,6 +411,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc1347.uvproj.tmpl b/workspace_tools/export/uvision4_lpc1347.uvproj.tmpl index 19792091d3..171fc70c7e 100644 --- a/workspace_tools/export/uvision4_lpc1347.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc1347.uvproj.tmpl @@ -388,10 +388,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -411,6 +412,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc1768.uvproj.tmpl b/workspace_tools/export/uvision4_lpc1768.uvproj.tmpl index 4d038b9e39..8f16a02ba1 100644 --- a/workspace_tools/export/uvision4_lpc1768.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc1768.uvproj.tmpl @@ -390,10 +390,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -413,6 +414,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc4088.uvproj.tmpl b/workspace_tools/export/uvision4_lpc4088.uvproj.tmpl index 4a405b44a0..7f27cb75ae 100644 --- a/workspace_tools/export/uvision4_lpc4088.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc4088.uvproj.tmpl @@ -392,10 +392,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -415,6 +416,7 @@ {% endfor %} + {% endfor %} diff --git a/workspace_tools/export/uvision4_lpc812.uvproj.tmpl b/workspace_tools/export/uvision4_lpc812.uvproj.tmpl index 33389ca8ff..84fd7f6af8 100644 --- a/workspace_tools/export/uvision4_lpc812.uvproj.tmpl +++ b/workspace_tools/export/uvision4_lpc812.uvproj.tmpl @@ -393,10 +393,11 @@ + {% for group,files in source_files %} - src + {{group}} - {% for file in source_files %} + {% for file in files %} {{file.name}} {{file.type}} @@ -416,6 +417,7 @@ {% endfor %} + {% endfor %}