Clone of official tools
Diff: export/uvision/__init__.py
- Revision:
- 40:7d3fa6b99b2b
- Parent:
- 36:96847d42f010
- Child:
- 41:2a77626a4c21
--- a/export/uvision/__init__.py Wed Jul 19 16:44:30 2017 -0500 +++ b/export/uvision/__init__.py Tue Oct 10 16:56:30 2017 -0500 @@ -9,7 +9,7 @@ from tools.arm_pack_manager import Cache from tools.targets import TARGET_MAP -from tools.export.exporters import Exporter, filter_supported +from tools.export.exporters import Exporter, apply_supported_whitelist from tools.export.cmsis import DeviceCMSIS cache_d = False @@ -129,8 +129,13 @@ "MTSCode.combine_bins_mts_dragonfly", "NCS36510TargetCode.ncs36510_addfib" ]) - TARGETS = [tgt for tgt in filter_supported("ARM", POST_BINARY_WHITELIST) - if DeviceCMSIS.check_supported(tgt)] + + @classmethod + def is_target_supported(cls, target_name): + target = TARGET_MAP[target_name] + return apply_supported_whitelist( + cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target) and\ + DeviceCMSIS.check_supported(target_name) #File associations within .uvprojx file file_types = {'.cpp': 8, '.c': 1, '.s': 2, @@ -162,11 +167,13 @@ """Format toolchain flags for Uvision""" flags = copy.deepcopy(self.flags) # to be preprocessed with armcc - asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + \ - ",".join(flags['asm_flags']) + asm_flag_string = ( + '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + + ",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags']))) flags['asm_flags'] = asm_flag_string # All non-asm flags are in one template field c_flags = list(set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags'])) + ld_flags = list(set(flags['ld_flags'] )) # These flags are in template to be set by user i n IDE template = ["--no_vla", "--cpp", "--c99"] # Flag is invalid if set in template @@ -174,6 +181,7 @@ invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x) flags['c_flags'] = [flag.replace('"','\\"') for flag in c_flags if not invalid_flag(flag)] flags['c_flags'] = " ".join(flags['c_flags']) + flags['ld_flags'] = " ".join(flags['ld_flags']) return flags def format_src(self, srcs): @@ -209,10 +217,12 @@ # UVFile tuples defined above 'project_files': sorted(list(self.format_src(srcs).iteritems()), key=lambda (group, _): group.lower()), - 'linker_script':self.resources.linker_script, + 'linker_script':self.toolchain.correct_scatter_shebang( + self.resources.linker_script), 'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'), 'device': DeviceUvision(self.target), } + self.generated_files.append(ctx['linker_script']) core = ctx['device'].core ctx['cputype'] = core.rstrip("FD") if core.endswith("FD"):