Skip to content

PSOC6: enable export to CMake #9756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2019
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
5 changes: 3 additions & 2 deletions tools/export/cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -83,7 +84,7 @@ def generate(self):
'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"),
Expand Down
9 changes: 9 additions & 0 deletions tools/export/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def libraries(self):
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:
Expand Down
7 changes: 1 addition & 6 deletions tools/export/makefile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ def generate(self):
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,
Expand All @@ -98,7 +93,7 @@ def generate(self):
'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")
Expand Down