Skip to content
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

PSOC6: enable export to CMake #9756

Merged
merged 2 commits into from Feb 20, 2019

Conversation

Projects
None yet
7 participants
@vmedcy
Copy link
Contributor

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

PSOC6: enable export to CMake
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 ARMmbed/mbed-os-maintainers Feb 19, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

ciarmcom commented Feb 19, 2019

@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)

This comment has been minimized.

@theotherjimmy

theotherjimmy Feb 19, 2019

Contributor

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]

This comment has been minimized.

@vmedcy

vmedcy Feb 19, 2019

Author Contributor

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.

This comment has been minimized.

@theotherjimmy

theotherjimmy Feb 19, 2019

Contributor

Should it be a function on the base exporter class then? That way there's no need to keep them in sync.

This comment has been minimized.

@vmedcy

vmedcy Feb 19, 2019

Author Contributor

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.

This comment has been minimized.

@vmedcy

vmedcy Feb 19, 2019

Author Contributor

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

tools/export: move hex_files selection to base Exporter class
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

cmonr approved these changes Feb 19, 2019

@cmonr

This comment has been minimized.

Copy link
Contributor

cmonr commented Feb 19, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

mbed-ci commented Feb 19, 2019

Test run: SUCCESS

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

@cmonr cmonr added ready for merge and removed needs: CI labels Feb 20, 2019

@0xc0170 0xc0170 merged commit e591662 into ARMmbed:master Feb 20, 2019

27 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 9158 cycles (-1240 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.