-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Multi image #1508
Multi image #1508
Conversation
All checks are passing now. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
942d1fe
to
adba242
Compare
@SebastianBoe great with the ToDo list introduced.
|
The parital-reconfiguration TODO is not about extending functionality, just about understanding the consequences of the current design. I believe all TODOs are about ensuring we get as close as possible to the same functionality as before. |
Then I might have misread that TODO, cause with existing solution, a change in any |
Not sure what you mean by same CMake instance. A single CMake instance has a reconfigure dependency on all .config files. But, is it possible, in the current design, for a sub-image to re-configure (without modifying it's .config), without this triggering a re-configure for all images, and if so should this, or should this not be supported. EDIT: I suspect it is possible and it should not be supported, but I haven't investigated yet. |
To clarify our discussion offline, we are only still considering this for zephyr and mcuboot, right? Other repositories will simply be pointed back at upstream. |
d6e89ae
to
79576f8
Compare
That's my proposal. |
79576f8
to
abcd43f
Compare
Yes, that's correct. For other repos we'll just point to master of the upstream counterparts. |
cda776e
to
55f75e5
Compare
@carlescufi @mbolivar manifest now points upstream |
Excellent. I believe then that this comment in west.yml no longer applies:
The reason these were segregated is because these modules' CMakeLists.txt files had not been audited for IMAGE prefixes. Now that this prefix is no longer necessary, I believe we can unify the two lists of projects, right? |
63df801
to
38dc27e
Compare
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 added another commit with updates and some questions.
90940b5
to
049ef9f
Compare
@ru-fu : Please re-assess the review |
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.
The docs look good.
73ac24a
to
c027dc4
Compare
The DOC failure is in nrf/rst/doc/nrf/samples/bluetooth/mesh/light/README.rst and is not our fault, it is a known CI issue. |
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.
Tested with 10090ns sample with mcuboot and secure bootloader.
Verified that building of S1 candidate of mcuboot works correctly, and that second mcuboot update to S0 also works.
c027dc4
to
463c424
Compare
ab390ef
to
48b08e2
Compare
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.
Looking good.
Only a small couple of minor comments, so great work: 👍
Added one more commit: 8a2093c
to ensure toolchain and board dir are propagated to child images.
This could especially be important to SES.
Feel free to squash the additional commit into existing work.
execute_process( | ||
COMMAND ${CMAKE_COMMAND} | ||
-G${CMAKE_GENERATOR} | ||
${EXTRA_MULTI_IMAGE_CMAKE_ARGS} # E.g. --trace-expand |
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.
Can you provide some more information on this ?
How is it intended to be used, cause I don't see this added in documentation.
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.
Docs added
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.
BUILD_BYPRODUCTS ${${name}_BUILD_BYPRODUCTS} # Set by shared_vars.cmake | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} | ||
${EXTRA_MULTI_IMAGE_BUILD_OPT} # E.g. -v |
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 see where you want to go, question is, do we want to open this possibility now, through CMake.
or should we actually describe to user that it is possible to do:
ninja -C spm -v
if verbose output from the child image build is requested.
That is, do we want to document:
cmake -DEXTRA_MULTI_IMAGE_BUILD_OPT='-v' ...
ninja # (This will give verbose build output for all child images but not parent )
or
cmake ...
ninja -C spm -v # (This will give verbose build output for spm child image)
ninja # (build parent and other child image with normal build output)
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.
IIRC directly invoking child images can corrupt the build in certain situations so I'd rather not encourage this.
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.
Docs added
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.
IIRC directly invoking child images can corrupt the build in certain situations so I'd rather not encourage this.
Not correct, cause we always rebuild child image if need be.
https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/48b08e23acb2628b8182cf4608447c498ffa49c4/cmake/multi_image.cmake#L155
This means that when running:
ninja -C spm
ninja
you will normally see:
$ ninja -C spm
ninja: Entering directory `spm'
...
[179/179] Linking C executable zephyr/zephyr.elf
$ ninja
[1/209] Preparing syscall dependency handling
[15/209] Performing build step for 'spm_subimage'
ninja: no work to do.
[21/209] Performing build step for 'mcuboot_subimage'
...
Merged /projects/github/ncs/nrf/samples/nrf9160/aws_fota/build/zephyr/app_signed.hex
$
Now, in this case, the child image was up-to-date.
Let's call that scenario 0.
Now, if we have the following two scenarios:
$ ninja -C spm
ninja: Entering directory `spm'
...
[179/179] Linking C executable zephyr/zephyr.elf
$ ninja
[1/209] Preparing syscall dependency handling
# Scenario 1: Something in build system touches child image dependencies at this build stage.
# Thus requiring a rebuild of spm_subimage.
[15/209] Performing build step for 'spm_subimage'
ninja: no work to do. # In scenario 1) a rebuild would occur instead.
# Scenario 2: Something in build system touches child image dependencies at this build stage.
# Thus requiring a rebuild of spm_subimage,
# but as spm_subimage is already built, there is a problem.
[21/209] Performing build step for 'mcuboot_subimage'
...
Merged /projects/github/ncs/nrf/samples/nrf9160/aws_fota/build/zephyr/app_signed.hex
$
Now, in scenario 1, everything is fine, because the child image will be rebuild with correct files and it does not matter how many times user has executed ninja -C spm
.
In scenario 2 however, the dependencies are not correctly defined in CMake, and we can never trust the final result, as child image may be out of date.
In scenario 2) we have a more fundamental issue, that is not related to the user running ninja -C spm
.
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.
scenario 2 is that the child image depends on a file that is generated by the parent image right?
I think our current strategy is for the parent to express this dependency. If the user always invokes the parent then this works fine. If the child expresses this dependency I'm worried we might get a loop, or be invoking ninja/cmake more often than necesary.
So as I see it scenario 2 is about whether we encourage invoking ninja -C spm or not, as this determines whether dependencies are resolved correctly or not.
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'm saying I don't trust it when child images are invoked directly.
I am not aware of any dependency issues when the parent image is invoked.
I don't see how the always-outdated status of child-images relates to the scenario we are discussing, because this is a property of the parent image (which is not even invoked).
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.
how would that ever happen
This is what I understood your proposal here was:
ExternalProject_Add(${name}_subimage
...
DEPENDS <parent_target-generating::file-generated-by-parent>
)
Or was this code meant to be in the parent image?
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 would still suggest we remove this special argument
As a compromise, I would be willing to remove the documentation, then users won't have to read about an option that there are very few use-cases for.
But I would like to keep it present so I don't have to modify sources when I need to add a flag to ninja.
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 would still suggest we remove this special argument
As a compromise, I would be willing to remove the documentation, then users won't have to read about an option that there are very few use-cases for.
But I would like to keep it present so I don't have to modify sources when I need to add a flag to ninja.
I think we can close the discussion here as this PR is merged.
I do acknowledge users might want to do be able to increase verbosity
on child image builds (although I would personally prefer ninja -C <path> -v
) but if supporting it in the general, I would really prefer we stick to existing CMake flags.
Therefore I created PR #1650 to continue the discussion over there.
btw. always great with passionate developers, even though it also means disagreements from time to time 💥 😄
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.
how would that ever happen
ExternalProject_Add(${name}_subimage ... DEPENDS <parent_target-generating::file-generated-by-parent> )
Or was this code meant to be in the parent image?
yep, that code was supposed to be in parent code, to ensure child is always built AFTER file has been generated by parent.
999ec7d
to
3b5c06b
Compare
This commit introduces the use of CMake External Project for multi-image builds. This commit also updates the manifest file to include the multi-image updates in the following zephyr modules - zephyr - mcuboot - nrfxlib It updates the manifest file to track upstream zephyr vewrsion of the folowing zephyr modules - tinycbor - mbedtls - mcumgr Signed-off-by: Torsten Rasmussen <[email protected]>
3b5c06b
to
9588c77
Compare
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 see the PR is merged already, but please update the docs as commented.
This PR seems to have broken
Emitted from |
Will look into it. Steps to reproduce? |
Intermittent error it seems was able to rebuild and it ran successfully with this patch. |
path: modules/lib/tinycbor | ||
revision: 86d5ed5dd544b107d2d0882961a19c2c6cb06572 | ||
revision: 0fc68fceacd1efc1ce809c5880c380f3d98b7b6e |
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.
@de-nordic Any idea why tinycbor reference should be zephyr upsteream and not NCS fork?
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.
@de-nordic Any idea why tinycbor reference should be zephyr upsteream and not NCS fork?
Not instantly. I am looking into this.
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 is incorrect. There should be no outside reference.
What should have been done instead is update to NCS fork of tinycbor (fw-nrfconnect-tinycbor) and reference to that update.
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.
The diff between these two SHA's is only removing IMAGE prefixes. So I believe this is correct.
When there is no difference between NCS and zephyrproject it is policy to directly use zephyrproject.
cd ncs/modules/lib/tinycbor/
git remote add us https://github.com/zephyrproject-rtos/tinycbor
git difftool 86d5ed5dd544b107d2d0882961a19c2c6cb06572 0fc68fceacd1efc1ce809c5880c380f3d98b7b6e
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.
When there is no difference between NCS and zephyrproject it is policy to directly use zephyrproject.
OK, so if this is accepted policy then OK.
This PR introduces the use of multi image builds using external process for CMake configure and external project for building.
It removes the need for
${IMAGE}
in code.It relates to the following set of PRs:
TODO: