-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
The approach for the hex_files subset selection is identical to makefile exporter: #9466 Single hex file should be passed to srec_cat when hex_filename is set in targets.json or mbed_app.json.
@vmedcy, thank you for your changes. |
tools/export/cmake/__init__.py
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same thing:
hex_files = list(f for f in hex_files if basename(f) == hex_filename) | |
hex_files = [f for f in hex_files if basename(f) == hex_filename] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggestion, will use the syntax next time I touch the exporter code.
For now I'd like to keep the code in cmake and makefile exporters in sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be a function on the base exporter class then? That way there's no need to keep them in sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add new property to the base Exporter class, similar to existing libraries property, and update cmake and makefile exporters to use it. Please confirm this is correct:
@property
def hex_files(self):
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
If so, I will update this PR with the proposed change and update both exporters to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed cf0ea92 and tested it has no functional impact (verified mbed export -m CY8CKIT_062_BLE -i cmake_gcc_arm
and mbed export -m CY8CKIT_062_BLE -i eclipse_gcc_arm
).
I also used [] to initalize the python list.
Please review. I updated the PR description to mention this is [X] Refactor
CMake and makefile exporters share a common logic for hex file selection. Factor it as a common property in the base class to avoid code duplication.
CI started |
Test run: SUCCESSSummary: 12 of 12 test jobs passed |
Description
CMake exporter needs to select a single hex file with CM0+ prebuilt image from resources.
The approach for the hex_files subset selection is identical to makefile exporter: #9466
Single hex file should be passed to srec_cat when "hex_filename" is set in targets.json or mbed_app.json.
There is no impact on non-PSoC6 targets (without "hex_filename" attribute in targets.json).
Pull request type
Reviewers
@theotherjimmy
Release Notes