-
Notifications
You must be signed in to change notification settings - Fork 3k
CMake: Add post build operation support #14235
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
Conversation
@hugueskamba, thank you for your changes. |
Backward compatible then, where we start tracking what we actually use in CMake so we do not remove these dependencies. We already have one memmap. |
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.
Let's add to our Readme these dependencies. We can add a section: to migrate from old tools and have a list of files we updated and reusing.
- tools/memmap.py
- tools/targets/*
- etc
To maintain this deps somewhere and once we do clean up we do not lose what is important.
My initial though we start from scratch and port what we can reuse but without old system deps, not bringing what we do not need. Let's see what others think.
tools/targets/__init__.py
Outdated
@@ -1,6 +1,6 @@ | |||
""" | |||
mbed SDK | |||
Copyright (c) 2011-2020 ARM Limited | |||
Copyright (c) 2011-2021 ARM Limited |
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.
why do we need this file (changing it here) ? I would expect to not to use this one at all. It's one common that we should not need. If we need something from here, we should move it to targets scripts rather. This file contains too many information for the old build system.
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 file is not used for the new build system. It was modified because it uses one of the API that was modified. However, I can add a wrapper API function so this stays as it was.
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.
Done. Changes to this file have been reverted.
75f8e6a
to
40f1111
Compare
40f1111
to
161376a
Compare
This force-push adds to the CMake tools README a listing of the Python modules needed to run post-build hooks. |
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 am still voting for moving out scripts we use to separate tools/cmake directory (generic ones), and targets to targets/..../scripts.
tools/targets/
should not be invoked from CMake. We are just postponing the clean up to later day for what benefit?
I can't tell from this PR what we actually still using from old tools in some scripts - PSOC6.py is questionable.
Let's move targets script to their CMake parts and have all in one place cleaned up. Even if we duplicate, we have clean slate and use CMake to provide information. Any deps from the old tools should be removed.
tools/targets/PSOC6.py
Outdated
def merge_action(args): | ||
"""Entry point for the "merge" CLI command.""" | ||
complete_func( | ||
print, args.elf, args.m4hex, args.m0hex |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
tools/targets/ARM_MUSCA_S1.py
Outdated
|
||
# Ensure the psa module is visible to this script | ||
sys.path.insert(0, TFM_SCRIPTS) | ||
|
||
from tools.psa.tfm.bin_utils.assemble import Assembly |
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 am scared of this to see tools. there but that will be cleaned up hopefully via TFM support PR.
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 think we're still too coupled to the old tools. Let's just factor out the business logic of these post build hooks and duplicate the core functionality it in a set of super simple scripts we can run from CMake.
After we've done that we can see what we actually need from the old tools/scripts and possibly factor that code into a python package later, but only if it makes sense to do so.
I think this approach of trying to merge our new code with the old tools spaghetti is going to leave us with more problems to solve later when we deprecate the old tools.
Pull request has been modified.
The current approach is to re-use what has been working this is the scope of this task. Only the necessary changes to be called from the CLI had to be made. It still leaves the opportunity to call new Python scripts once we schedule the re-factoring of post-build operations. Duplicating the functionality and refactoring the code could introduce some bugs. My experience with the old tools is that they usually do more than what is immediately apparent. It will therefore require more time than we currently have allocated to refactor and add tests to make sure it works exactly as the old scripts. I will add a task in the backlog to refactor the post build operations scripts. |
7e4000c
to
bd37c6e
Compare
Jenkins CI Test : ❌ FAILEDBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Github hiccups, CI restarted |
The file with the requested change is not part of this PR.
Jenkins CI Test : ❌ FAILEDBuild Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
@hugueskamba Please rebase, we will restart testing asap |
A CMake custom target, mbed-post-build, is added as a dependency of the application CMake target if a Mbed target adds a CMake custom target named mbed-post-build-bin. mbed-post-build-bin is added as a dependency of mbed-post-build. mbed-post-build-bin depends on the application binary. This is done so a CMake custom command that executes post-build can be added. The Python scripts that implement the operations have been modified to add CLI entry points so they can be called from CMake. Dependency on the old tool has been removed on those scripts by passing them exactly what they require instead of passing old tool Python objects. A consequence of that was to slightly amend how the old tool calls some of those Python modules. Support has only been added for Mbed targets that currently have a requirement for post build operations. This includes: LPC1114, LPC1768, ARCH_PRO, LPC54114, LPC546XX, FF_LPC546XX, CY8CKIT064B0S2_4343W, CYTFM_064B0S2_4343W, CYSBSYSKIT_01 The following targets are not supported as TFM support is not yet included: ARM_MUSCA_B1, ARM_MUSCA_B1_NS, ARM_MUSCA_S1, ARM_MUSCA_S1_NS.
bd37c6e
to
deeaa79
Compare
Pull request has been modified.
I have now rebased from master and squashed the commits. |
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 3 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
A CMake custom target,
mbed-post-build
, is added as a dependency of theapplication CMake target if a Mbed target adds a CMake custom target
named
mbed-post-build-bin
.mbed-post-build-bin
is added as a dependencyof
mbed-post-build
.mbed-post-build-bin
depends on the application binary.This is done so a CMake custom command that executes post-build can be added.
The Python scripts that implement the operations have been modified to add
CLI entry points so they can be called from CMake. Dependency on the old
tool has been removed on those scripts by passing them exactly what they
require instead of passing old tool Python objects. A consequence of that
was to slightly amend how the old tool calls some of those Python modules.
Support has only been added for Mbed targets that currently have a requirement
for post build operations. This includes:
LPC1114
,LPC1768
,ARCH_PRO
,LPC54114
,LPC546XX
,FF_LPC546XX
,CY8CKIT064B0S2_4343W
,CYTFM_064B0S2_4343W
,CYSBSYSKIT_01
.The following Mbed boards do not have post build operations support as TFM
is not yet supported:
ARM_MUSCA_B1
,ARM_MUSCA_B1_NS
,ARM_MUSCA_S1
,ARM_MUSCA_S1_NS
.Summary of changes
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers