Skip to content

Commit e591662

Browse files
authored
Merge pull request #9756 from vmedcy/psoc6-cmake-export
PSOC6: enable export to CMake
2 parents 7f4475d + cf0ea92 commit e591662

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

tools/export/cmake/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class CMake(Exporter):
4444
"MCU_NRF51Code.binary_hook",
4545
"TEENSY3_1Code.binary_hook",
4646
"LPCTargetCode.lpc_patch",
47-
"LPC4088Code.binary_hook"
47+
"LPC4088Code.binary_hook",
48+
"PSOC6Code.complete"
4849
])
4950

5051
@classmethod
@@ -83,7 +84,7 @@ def generate(self):
8384
'include_paths': includes,
8485
'library_paths': sorted([re.sub(r'^[.]/', '', l) for l in self.resources.lib_dirs]),
8586
'linker_script': self.resources.linker_script,
86-
'hex_files': self.resources.hex_files,
87+
'hex_files': self.hex_files,
8788
'ar': basename(self.toolchain.ar),
8889
'cc': basename(self.toolchain.cc[0]),
8990
'cc_flags': " ".join(flag for flag in self.toolchain.cc[1:] if not flag == "-c"),

tools/export/exporters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ def libraries(self):
141141
return [l for l in self.resources.get_file_names(FileType.LIB)
142142
if l.endswith(self.toolchain.LIBRARY_EXT)]
143143

144+
@property
145+
def hex_files(self):
146+
"""Returns a list of hex files to include in the exported project"""
147+
hex_files = self.resources.hex_files
148+
if hasattr(self.toolchain.target, 'hex_filename'):
149+
hex_filename = self.toolchain.target.hex_filename
150+
hex_files = [f for f in hex_files if basename(f) == hex_filename]
151+
return hex_files
152+
144153
def toolchain_flags(self, toolchain):
145154
"""Returns a dictionary of toolchain flags.
146155
Keys of the dictionary are:

tools/export/makefile/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ def generate(self):
8484
sys_libs = [self.prepare_sys_lib(lib) for lib
8585
in self.toolchain.sys_libs]
8686

87-
hex_files = self.resources.hex_files
88-
if hasattr(self.toolchain.target, 'hex_filename'):
89-
hex_filename = self.toolchain.target.hex_filename
90-
hex_files = list(f for f in hex_files if basename(f) == hex_filename)
91-
9287
ctx = {
9388
'name': self.project_name,
9489
'to_be_compiled': to_be_compiled,
@@ -98,7 +93,7 @@ def generate(self):
9893
'linker_script': self.resources.linker_script,
9994
'libraries': libraries,
10095
'ld_sys_libs': sys_libs,
101-
'hex_files': hex_files,
96+
'hex_files': self.hex_files,
10297
'vpath': (["../../.."]
10398
if (basename(dirname(dirname(self.export_dir)))
10499
== "projectfiles")

0 commit comments

Comments
 (0)