Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions tools/export/uvision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tools/export/uvision/uvision.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Vendor>{{device.dvendor}}</Vendor>
<PackID>{{device.pack_id}}</PackID>
<PackURL>{{device.pack_url}}</PackURL>
<Cpu>CPUTYPE("{{cputype}}")</Cpu>
<Cpu>CPUTYPE("{{cputype}}") {{fputype}}</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>{{device.flash_dll}}</FlashDriverDll>
Expand Down