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

PSOC6: enable export to CMake #9756

merged 2 commits into from
Feb 20, 2019

Conversation

vmedcy
Copy link
Contributor

@vmedcy vmedcy commented Feb 19, 2019

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

[ ] Fix
[X] Refactor
[X] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@theotherjimmy

Release Notes

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.
@ciarmcom ciarmcom requested review from theotherjimmy and a team February 19, 2019 14:00
@ciarmcom
Copy link
Member

@vmedcy, thank you for your changes.
@theotherjimmy @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

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)
Copy link
Contributor

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:

Suggested change
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]

Copy link
Contributor Author

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.

Copy link
Contributor

@theotherjimmy theotherjimmy Feb 19, 2019

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
@cmonr
Copy link
Contributor

cmonr commented Feb 19, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit e591662 into ARMmbed:master Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants