Skip to content

CMake: remove need for APP_TARGET #14265

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Feb 11, 2021
Merged

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Feb 10, 2021

Summary of changes

The recent changes added a new requirement to app/tests - APP_TARGET to be defined. This PR is addressing this issue. It is not completely getting rid of the application dependency (see commit messages for details). I'll create separate issue to fix Gcc Arm memory map and also how to preprocess linker scripts. Both issues will be addressed in the next 2 weeks. We are not able to fix it in the upcoming release (code freeze later this week).

mbed_configure_app_target stays for now. It will be removed as it should not be required.

I tested couple of targets with blinky to see if compile defs are properly defined and it builds without errors.

Impact of changes

Migration actions required

Documentation


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


We set language standard via mbed-core and app inherits it if links to it.
This is breaking change for application, please remove the function call from an
application and it should build without errors.
This fixes the problem for an app/test to define APP_TARGET as requirements. This is not a proper fix
but rather a workaround for broken apps/tests currently. We will address this separately via new
pull request.
We need to fix linker script differently, it should not need APP_TARGET. This is a series of
commits fixing APP_TARGET in our tree. We should not require it.

The linker script preprocessing will be fixed differently. "application" prefix is temporary until
we clean this up completely.
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Feb 10, 2021
@ciarmcom ciarmcom requested review from a team February 10, 2021 14:30
@ciarmcom
Copy link
Member

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

@rajkan01
Copy link
Contributor

@0xc0170 This PR changes remove the dependency of APP_TARGET CMake variable but it fails to create map file for GCC_ARM toolchain with DISCO_L475VG_IOT01A for blinky example build.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Feb 10, 2021

@0xc0170 This PR changes remove the dependency of APP_TARGET CMake variable but it fails to create map file for GCC_ARM toolchain with DISCO_L475VG_IOT01A for blinky example build.

That should be fixed, it's due to the name . We need to remove the last commit and fix it differently. I'll look at this later today.

@rwalton-arm
Copy link
Contributor

@0xc0170 This PR changes remove the dependency of APP_TARGET CMake variable but it fails to create map file for GCC_ARM toolchain with DISCO_L475VG_IOT01A for blinky example build.

That should be fixed, it's due to the name . We need to remove the last commit and fix it differently. I'll look at this later today.

Do we just need to update the memap.py invocation here:

COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map

target_link_options(${input_target}
INTERFACE
"-T" "${LINKER_SCRIPT_PATH}"
"-Wl,-Map=${CMAKE_BINARY_DIR}/${APP_TARGET}${CMAKE_EXECUTABLE_SUFFIX}.map"
"-Wl,-Map=${CMAKE_BINARY_DIR}/application${CMAKE_EXECUTABLE_SUFFIX}.map"
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing the APP_TARGET dependency is great as it was the main roadblock to having multiple CMake targets.

But the hardcode won't help much.

Would using CMAKE_CURRENT_BINARY_DIR work? Something like:

Suggested change
"-Wl,-Map=${CMAKE_BINARY_DIR}/application${CMAKE_EXECUTABLE_SUFFIX}.map"
"-Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/application${CMAKE_EXECUTABLE_SUFFIX}.map"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this is causing a trouble, can you create an issue? we use binary dir in multiple places so should be fixed for all.

This allows us to keep all in one place and fix (removing this function later)
@0xc0170
Copy link
Contributor Author

0xc0170 commented Feb 10, 2021

I moved also -Map for Gcc Arm to the function we will remove later and refactor. This should completely fix APP_TARGET usage in our tree. Only reminder there is mbed_configure_app_target that requires more work and we can remove it as well (another day another PR).

@0xc0170
Copy link
Contributor Author

0xc0170 commented Feb 10, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 11, 2021

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-test
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170
Copy link
Contributor Author

0xc0170 commented Feb 11, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented Feb 11, 2021

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-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-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170
Copy link
Contributor Author

0xc0170 commented Feb 11, 2021

Waiting for final reviews after my last fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants