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

CMake: pass macros to ARM toolchain linker #13930

Merged
merged 2 commits into from
Nov 24, 2020

Conversation

LDong-Arm
Copy link
Contributor

Summary of changes

Compile definitions (macros) should be passed to both GCC_ARM and ARM toolchains:

  • For GCC_ARM, the linker script is preprocessed, which is already the case
  • For the ARM toolchain, we can pass --predefine=@<definition_file>.txt directly to armlink. This PR adds such support.

This is necessary, if an application needs to start with an offset (MBED_APP_START), e.g. to be loaded by a bootloader.

Impact of changes

Macros are now passed to the Arm Compiler linker.

Migration actions required

None.

Documentation

None.


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@0xc0170 @hugueskamba @rajkan01


@LDong-Arm LDong-Arm changed the title CMake: support macros for ARM toolchain linker CMake: pass macros to ARM toolchain linker Nov 19, 2020
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Nov 19, 2020
@ciarmcom
Copy link
Member

@LDong-Arm, thank you for your changes.
@rajkan01 @0xc0170 @hugueskamba @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 19, 2020

I knew GCC Arm did not pass it by default but I don't recall why I was under impression ARMClang is passing them to linker by default 🙄 If that is the case, making the symbols already done for gcc also to other toolchain +1.

I'll review.

@LDong-Arm
Copy link
Contributor Author

No matter what compiler we use, the build system needs to macros in some way. And CMake doesn't pass macros (compile definitions) at linking stage by default, so we need to do it.
The difference between arm-none-eabi-ld and armlink is the former doesn't support macros (thus requires preprocessing) and the latter does support that.

Copy link
Contributor

@evedon evedon left a comment

Choose a reason for hiding this comment

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

LGTM

@mergify mergify bot added needs: CI and removed needs: review labels Nov 19, 2020
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

I wonder if we can fix this via toolchain file (add these macros to linker by default for both toolchains). I'll create a ticket for this to review

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 20, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Nov 20, 2020

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest

@mergify mergify bot added needs: work and removed needs: CI labels Nov 20, 2020
@LDong-Arm
Copy link
Contributor Author

I've seen the cloud-client-test failure in multiple PRs today, might be a CI issue?

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 20, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Nov 20, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170 0xc0170 merged commit 214291b into ARMmbed:master Nov 24, 2020
@mergify mergify bot removed the ready for merge label Nov 24, 2020
@LDong-Arm LDong-Arm deleted the arm_compiler_macros branch November 24, 2020 14:17
@mbedmain mbedmain added release-version: 6.6.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Dec 11, 2020
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