Correct uvisionn export

pull/8757/head
Jimmy Brisson 2018-12-07 09:55:30 -06:00
parent dbbf336949
commit 9de37ec39c
3 changed files with 23 additions and 22 deletions

View File

@ -36,16 +36,21 @@ class DeviceCMSIS():
target_info = self.check_supported(target) target_info = self.check_supported(target)
if not target_info: if not target_info:
raise TargetNotSupportedException("Target not supported in CMSIS pack") raise TargetNotSupportedException("Target not supported in CMSIS pack")
self.url = target_info['pdsc_file'] self.pack_url = target_info['from_pack']['url']
self.pdsc_url, self.pdsc_id, _ = split_path(self.url) self.pack_id = "{}.{}.{}".format(
self.pack_url, self.pack_id, _ = split_path(target_info['pack_file']) target_info['from_pack']['vendor'],
target_info['from_pack']['pack'],
target_info['from_pack']['version']
)
self.dname = target_info["_cpu_name"] self.dname = target_info["_cpu_name"]
self.core = target_info["_core"] self.core = target_info["_core"]
self.dfpu = target_info['processor']['fpu'] try:
self.debug, self.dvendor = self.vendor_debug(target_info['vendor']) self.dfpu = target_info['processor']['Symmetric']['fpu']
except KeyError:
self.dfpu = target_info['processor']['Asymmetric']['fpu']
self.debug, self.dvendor = self.vendor_debug(target_info['from_pack']['vendor'])
self.dendian = target_info['processor'].get('endianness','Little-endian') self.dendian = target_info['processor'].get('endianness','Little-endian')
self.debug_svd = target_info.get('debug', '') self.debug_svd = target_info.get('debug', '')
self.compile_header = target_info['compile']['header']
self.target_info = target_info self.target_info = target_info
@staticmethod @staticmethod

View File

@ -26,7 +26,6 @@ class DeviceUvision(DeviceCMSIS):
self.svd = '' self.svd = ''
if self.debug_svd: if self.debug_svd:
self.svd = dev_format.format(self.dname, self.debug_svd) self.svd = dev_format.format(self.dname, self.debug_svd)
self.reg_file = dev_format.format(self.dname, self.compile_header)
self.debug_interface = self.uv_debug() self.debug_interface = self.uv_debug()
self.flash_dll = self.generate_flash_dll() self.flash_dll = self.generate_flash_dll()
@ -73,14 +72,10 @@ class DeviceUvision(DeviceCMSIS):
''' '''
fl_count = 0 fl_count = 0
def get_mem_no_x(mem_str):
mem_reg = "\dx(\w+)"
m = re.search(mem_reg, mem_str)
return m.group(1) if m else None
RAMS = [ RAMS = [
(get_mem_no_x(info["start"]), get_mem_no_x(info["size"])) (info["start"], info["size"])
for mem, info in self.target_info["memory"].items() if "RAM" in mem for mem, info in self.target_info["memories"].items()
if "RAM" in mem
] ]
format_str = ( format_str = (
"UL2CM3(-S0 -C0 -P0 -FD{ramstart}" "UL2CM3(-S0 -C0 -P0 -FD{ramstart}"
@ -92,24 +87,25 @@ class DeviceUvision(DeviceCMSIS):
if len(RAMS) >= 1: if len(RAMS) >= 1:
ramstart = RAMS[0][0] ramstart = RAMS[0][0]
extra_flags = [] extra_flags = []
for name, info in self.target_info["algorithm"].items(): for info in self.target_info["algorithms"]:
if not name or not info: if not info:
continue continue
if int(info["default"]) == 0: if not info["default"]:
continue continue
name = info['file_name']
name_reg = "\w*/([\w_]+)\.flm" name_reg = "\w*/([\w_]+)\.flm"
m = re.search(name_reg, name.lower()) m = re.search(name_reg, name.lower())
fl_name = m.group(1) if m else None fl_name = m.group(1) if m else None
name_flag = "-FF" + str(fl_count) + fl_name name_flag = "-FF" + str(fl_count) + fl_name
start = get_mem_no_x(info["start"]) start = '{:x}'.format(info["start"])
size = get_mem_no_x(info["size"]) size = '{:x}'.format(info["size"])
rom_start_flag = "-FS" + str(fl_count) + str(start) rom_start_flag = "-FS" + str(fl_count) + str(start)
rom_size_flag = "-FL" + str(fl_count) + str(size) rom_size_flag = "-FL" + str(fl_count) + str(size)
if info["ramstart"] is not None and info["ramsize"] is not None: if info["ramstart"] is not None and info["ramsize"] is not None:
ramstart = get_mem_no_x(info["ramstart"]) ramstart = '{:x}'.format(info["ramstart"])
ramsize = get_mem_no_x(info["ramsize"]) ramsize = '{:x}'.format(info["ramsize"])
path_flag = "-FP{}($$Device:{}${})".format( path_flag = "-FP{}($$Device:{}${})".format(
str(fl_count), self.dname, name str(fl_count), self.dname, name

View File

@ -25,7 +25,7 @@
<StartupFile></StartupFile> <StartupFile></StartupFile>
<FlashDriverDll>{{device.flash_dll}}</FlashDriverDll> <FlashDriverDll>{{device.flash_dll}}</FlashDriverDll>
<DeviceId>0</DeviceId> <DeviceId>0</DeviceId>
<RegisterFile>{{device.reg_file}}</RegisterFile> <RegisterFile></RegisterFile>
<MemoryEnv></MemoryEnv> <MemoryEnv></MemoryEnv>
<Cmp></Cmp> <Cmp></Cmp>
<Asm></Asm> <Asm></Asm>