Merge pull request #9756 from vmedcy/psoc6-cmake-export

PSOC6: enable export to CMake
pull/9774/head
Martin Kojtal 2019-02-20 09:39:35 +01:00 committed by GitHub
commit e59166289f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View File

@ -44,7 +44,8 @@ class CMake(Exporter):
"MCU_NRF51Code.binary_hook",
"TEENSY3_1Code.binary_hook",
"LPCTargetCode.lpc_patch",
"LPC4088Code.binary_hook"
"LPC4088Code.binary_hook",
"PSOC6Code.complete"
])
@classmethod
@ -83,7 +84,7 @@ class CMake(Exporter):
'include_paths': includes,
'library_paths': sorted([re.sub(r'^[.]/', '', l) for l in self.resources.lib_dirs]),
'linker_script': self.resources.linker_script,
'hex_files': self.resources.hex_files,
'hex_files': self.hex_files,
'ar': basename(self.toolchain.ar),
'cc': basename(self.toolchain.cc[0]),
'cc_flags': " ".join(flag for flag in self.toolchain.cc[1:] if not flag == "-c"),

View File

@ -141,6 +141,15 @@ class Exporter(object):
return [l for l in self.resources.get_file_names(FileType.LIB)
if l.endswith(self.toolchain.LIBRARY_EXT)]
@property
def hex_files(self):
"""Returns a list of hex files to include in the exported project"""
hex_files = self.resources.hex_files
if hasattr(self.toolchain.target, 'hex_filename'):
hex_filename = self.toolchain.target.hex_filename
hex_files = [f for f in hex_files if basename(f) == hex_filename]
return hex_files
def toolchain_flags(self, toolchain):
"""Returns a dictionary of toolchain flags.
Keys of the dictionary are:

View File

@ -84,11 +84,6 @@ class Makefile(Exporter):
sys_libs = [self.prepare_sys_lib(lib) for lib
in self.toolchain.sys_libs]
hex_files = self.resources.hex_files
if hasattr(self.toolchain.target, 'hex_filename'):
hex_filename = self.toolchain.target.hex_filename
hex_files = list(f for f in hex_files if basename(f) == hex_filename)
ctx = {
'name': self.project_name,
'to_be_compiled': to_be_compiled,
@ -98,7 +93,7 @@ class Makefile(Exporter):
'linker_script': self.resources.linker_script,
'libraries': libraries,
'ld_sys_libs': sys_libs,
'hex_files': hex_files,
'hex_files': self.hex_files,
'vpath': (["../../.."]
if (basename(dirname(dirname(self.export_dir)))
== "projectfiles")