Skip to content

PSOC6: correctly align hex files with split text sections #9781

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 1 commit into from
Feb 25, 2019
Merged

PSOC6: correctly align hex files with split text sections #9781

merged 1 commit into from
Feb 25, 2019

Conversation

vmedcy
Copy link
Contributor

@vmedcy vmedcy commented Feb 20, 2019

Description

When the original PSOC6 CM4 hex file contains unalinged text sections
that span through multiple intelhex segments, aligned segments (filled
with zeroes) overlap with the original data segments, resulting in
error thrown by ihex.merge(alignments, overlap='error').
Such hex file can be produced when the ELF is built with ARM MDK Compiler
with --split_sections option:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124944914.htm

Change the merge strategy to overlap='ignore', so that the overlapping
zero-filled segments are skipped.

Pull request type

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

Reviewers

Release Notes

When the original PSOC6 CM4 hex file contains unalinged text sections
that span through multiple intelhex segments, aligned segments (filled
with zeroes) overlap with the original data segments, resulting in
error thrown by ihex.merge(alignments, overlap='error').
Such hex file can be produced when the ELF is built with ARM MDK Compiler
with --split_sections option:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124944914.htm

Change the merge strategy to overlap='ignore', so that the overlapping
zero-filled segments are skipped.
@deepikabhavnani
Copy link

Split section is always enabled for ARM compiler, not sure why this issue was not seen earlier. Am I missing sometime here?

"common": ["-c", "--gnu", "-Otime", "--split_sections",

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would defer to @vmedcy and @deepikabhavnani in this case, its a bit target-specific for me.

@vmedcy
Copy link
Contributor Author

vmedcy commented Feb 21, 2019

@deepikabhavnani:

Split section is always enabled for ARM compiler, not sure why this issue was not seen earlier

The issue with unaligned HEX segments was first observed by Cypress BLE development team that tried to include prebuilt BLE stack controller library in GCC_ARM build. The stack library was precompiled using ARM Compiler 5 (with --split_sections option), then linked with arm-none-eabi-gcc using standard mbed compile -t GCC_ARM. GCC linker, unlike armlink, cannot align split functions from object code produced by ARM compiler. PSOC6.py re-aligns the HEX file correctly with this PR applied.
ELF file is aligned correctly when all object code is compiled and linked with ARM Compiler.

@deepikabhavnani
Copy link

@vmedcy - Thanks for explanation

Copy link

@deepikabhavnani deepikabhavnani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 25, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 25, 2019

Test run: SUCCESS

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

@cmonr cmonr merged commit 4532e41 into ARMmbed:master Feb 25, 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.

6 participants