Skip to content

Set executable suffix in CMake #14204

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 4 commits into from
Feb 3, 2021
Merged

Conversation

multiplemonomials
Copy link
Contributor

Summary of changes

Set CMAKE_EXECUTABLE_SUFFIX in the CMake build system. This will cause all final linked files to have the .elf extension instead of no extension. This is a bit more correct to build system standards, and it's also important to allow one to upload files using STM32CubeProg which only accepts elf files with a .elf extension.

Broken out from #14010 .

Impact of changes

Migration actions required

None.

Documentation

None needed..


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


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Jan 28, 2021
@ciarmcom ciarmcom requested review from 0xc0170 and a team January 28, 2021 00:30
@ciarmcom
Copy link
Member

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

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 assume this will work to have .elf always. In case some tool required own (uvision works with .axf, gcc usually has no extension), we rename to pass to the tooling ?

I can see trustfirmware uses axf https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/cmake/Common/BuildSys.cmake?h=e2c5a7ae51b6226ee3cf57ab70ff61f065d2da9b#n89

@multiplemonomials
Copy link
Contributor Author

Yeah, if it becomes a problem you could copy the executable with a different name as a post-build step, or you could even have the CMAKE_EXECUTABLE_SUFFIX be configurable.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 28, 2021

It looks like the current tools always have as well .elf then postprocess it to create hex/bin or other format.

0xc0170
0xc0170 previously approved these changes Jan 29, 2021
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.

One simple line addition and LGTM

@mergify mergify bot added needs: CI and removed needs: review labels Jan 29, 2021
@mergify mergify bot dismissed 0xc0170’s stale review January 29, 2021 17:01

Pull request has been modified.

@ciarmcom ciarmcom added the stale Stale Pull Request label Jan 31, 2021
@ciarmcom
Copy link
Member

This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-maintainers, please start CI to get the PR merged.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 1, 2021

I started the first CI run

@hugueskamba @rajkan01 Please review

@mergify mergify bot added needs: work and removed needs: CI labels Feb 1, 2021
@mbed-ci
Copy link

mbed-ci commented Feb 1, 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-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️

@ciarmcom ciarmcom removed the stale Stale Pull Request label Feb 1, 2021
CMakeLists.txt Outdated
@@ -203,7 +203,7 @@ function(mbed_generate_map_file target)
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}.map
Copy link
Contributor

Choose a reason for hiding this comment

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

Did this break ARMClang? See the logs

Finished: 0 information, 1 warning and 0 error messages.
-- built: /builds/workspace/mbed-os-ci_cmake-example-ARM@3/examples/mbed-os-example-kvstore/cmake_build/mbed-os-example-kvstore.bin
-- built: /builds/workspace/mbed-os-ci_cmake-example-ARM@3/examples/mbed-os-example-kvstore/cmake_build/mbed-os-example-kvstore.hex
usage: memap.py [-h] -t TOOLCHAIN [-d DEPTH] [-o OUTPUT] [-e EXPORT] [-v] file
memap.py: error: argument file: /builds/workspace/mbed-os-ci_cmake-example-ARM@3/examples/mbed-os-example-kvstore/cmake_build/mbed-os-example-kvstore.map does not exist in the filesystem.
ninja: build stopped: subcommand failed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is the offending cmd:

--map  --via=CMakeFiles/mbed-os-example-kvstore.rsp -o mbed-os-example-kvstore.elf  --list=mbed-os-example-kvstore.elf.map

@multiplemonomials
Copy link
Contributor Author

multiplemonomials commented Feb 2, 2021

Ah, I think I figured out what's up, I think that CMAKE_EXECUTABLE_SUFFIX was already being set to elf for ARMClang. Should be fixed now.

@mergify mergify bot added needs: CI and removed needs: work labels Feb 3, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 3, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 3, 2021

Jenkins CI Test : ✔️ SUCCESS

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

CLICK for Detailed Summary

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

@0xc0170 0xc0170 merged commit 24f035e into ARMmbed:master Feb 3, 2021
@mergify mergify bot removed the ready for merge label Feb 3, 2021
@mbedmain mbedmain added release-version: 6.8.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Feb 16, 2021
@multiplemonomials multiplemonomials deleted the cmake-exe-suffix branch May 17, 2023 06:54
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.

5 participants