-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Improve PSoC 6 post-build hooks, whitelist makefile export #9466
Conversation
PSoC 6 hex files contain 4-byte chip ID at virtual offset 0x90500002 added by PSoC Creator or cymcuelftool from .cymeta ELF section. merge_images compares chip ID in CM0+ and CM4 hex files and raises an exception in case of mismatch. Chip ID is different for each MPN (for example, 0xE2072100 for CY8C6347BZI-BLD53 and 0xE2062100 for CY8C6247BZI-D54). CM0+ prebuilt images target CY8C6347BZI-BLD53 but should be compatible with other PSoC6 MPNs. Remove the check to enable merging CM0+ images with CM4 applications built for different MPNs, with empty or absent cymetadata.
Replace hard-coded numeric offsets of PSoC 6 hex file sections with sensible constants. Do not attempt to update the checksum and metadata contents if the sections are not found in the original HEX file.
Rename the existing PSoC-specific m0_core_img key in targets.json as a more generic hex_filename key. Update makefile exporter to select the subset of resources.hex_files matching the hex_filename value. Without this fix, multiple prebuilt CM0+ hex files are found in the target resources and erroneously passed to the srec_cat tool. The fix is generic so other targets that need post-build hex merging can use this key to pass the correct image to srecord tool. The fix also removes sub_target key: instead, rely hex_filename json key to detect if the hex image merging needs to be done. The sub_target is not used in mbed-os codebase for anything else. It is possible to override the hex file name in mbed_app.json: { "target_overrides": { "*": { "target.hex_filename": "my_custom_m0_image.hex" } }
@vmedcy, thank you for your changes. |
Very good commit messages 👍 |
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 a breaking change: the prior definition of the PSoC6 will no longer work after these changes (mostly the rename of target.m0_core_img
to hex_filename
). Is this target released?
Yeah, but nobody used it in the online compiler, or outside of commenters on this PR
I agree. The FUTURE_SEQUANA target was released with mbed-os-5.10.3. But the board is not yet available publicly, so the impact is limited to engineers working on preview version of the board AND customizing the "target.m0_core_img" in the mbed_app.json. I dislike referencing target.m0_core_img in tools/export/makefile since the key name is too PSoC-specific. |
Agreed about the engineers affected. That's probably only me and @orenc17. Also, this is probably the last moment such a change could be pulled out.
My point was that hex_filename was too generic, but on the other hand, using it works quite nicely in the makefile exporter.
This, indeed, wouldn't make sense.
|
@lrusinowicz: thank you for your feedback, this is nice that we are aligned on this. |
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 would consider changing this to generate warning only, rather than error, and to handle "no metadata" case to not generate warning. This way hex images for M0 fitting multiple targets could exists (without signature) and user at least will be warned when trying to use image targeting incompatible MPN.
@lrusinowicz I do not think metadata check should be performed, for various reasons:
|
@vmedcy |
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.
Looks fine
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'm happy if we're confidant that very few people will be affected by the break.
I don't think anyone used the online compiler for this platform, so we should be good to go. |
CI started |
Test run: FAILEDSummary: 1 of 12 test jobs failed Failed test jobs:
|
Test restarted |
Just to confirm : this is fine for 5.11.4 (not 5.12) ? |
@0xc0170 Correct. 5.11.4 |
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.
The approach for the hex_files subset selection is identical to makefile exporter: ARMmbed#9466 Single hex file should be passed to srec_cat when hex_filename is set in targets.json or mbed_app.json.
Description
Various improvements to the Cypress PSoC 6 post-build python hooks that bring compatibility with Cypress PSoC 6 boards (pull request pending). The fixes have no functional impact on FUTURE_SEQUANA port and enable export to makefile of PSoC 6 targeting projects.
This pull request addresses some review feedback from #8491 related to hex file discovery in the exported projects.
Pull request type
Reviewers
@theotherjimmy @lrusinowicz @orenc17