diff --git a/tools/export/uvision/__init__.py b/tools/export/uvision/__init__.py index f571ebeaf8c..154a56ca045 100644 --- a/tools/export/uvision/__init__.py +++ b/tools/export/uvision/__init__.py @@ -178,6 +178,16 @@ def format_src(self, srcs): key=lambda (_, __, name): name.lower()) return grouped + @staticmethod + def format_fpu(core): + """Generate a core's FPU string""" + if core.endswith("FD"): + return "FPU3(DFPU)" + elif core.endswith("F"): + return "FPU2" + else: + return "" + def generate(self): """Generate the .uvproj file""" cache = Cache(True, False) @@ -197,10 +207,11 @@ def generate(self): 'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'), 'device': DeviceUvision(self.target), } - ctx['cputype'] = ctx['device'].core.rstrip("FD") + core = ctx['device'].core + ctx['cputype'] = core.rstrip("FD") # Turn on FPU optimizations if the core has an FPU - ctx['fpu_setting'] = 1 if 'f' not in ctx['device'].core.lower() \ - or 'd' in ctx['device'].core.lower() else 2 + ctx['fpu_setting'] = 1 if 'F' not in core or 'D' in core else 2 + ctx['fputype'] = self.format_fpu(core) ctx.update(self.format_flags()) self.gen_file('uvision/uvision.tmpl', ctx, self.project_name+".uvprojx") self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx") diff --git a/tools/export/uvision/uvision.tmpl b/tools/export/uvision/uvision.tmpl index b8524088cd1..4ccb9a32281 100644 --- a/tools/export/uvision/uvision.tmpl +++ b/tools/export/uvision/uvision.tmpl @@ -16,7 +16,7 @@ {{device.dvendor}} {{device.pack_id}} {{device.pack_url}} - CPUTYPE("{{cputype}}") + CPUTYPE("{{cputype}}") {{fputype}} {{device.flash_dll}}