zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.03k stars 6.17k forks source link

Zephyr generic multi-image #41640

Open tejlmand opened 2 years ago

tejlmand commented 2 years ago

This is a meta issue trying to collect use-cases related to Zephyr multi-image builds.

Building of multiple images through a single build invocation together with flashing capabilities is a recurring feature request.

This meta issue tries to collect all the different scenarios which have been requested, including those which have a custom solution.

What is desired is an overall solution that is well designed and flexible enough to be extendable, both within Zephyr itself, but to the extend possible also providing hooks for downstream users.

Some examples:

Considerations:

Tasks covered with this meta issue:

Other related issues which benefits Sysbuild:

danieldegrasse commented 2 years ago

41697 tracks the use case required for #41579, namely the requirement to share information about a secondary image with a primary image in order to enable the primary core image to copy the secondary image from flash to ram

hubertmis commented 2 years ago

I would like to clarify a little the use-cases described as

  • Building and flashing of a multi-core SoC where both images are Zephyr based, for example: ipc/openamp

There are some samples in the Zephyr tree which by design can run only on multi-core SoC (like linked openamp samples). However, most of the available samples can run on single-core or multi-core SoCs. When these samples run on multi-core SoC, some require one image, other more.

For example net/sockets/echo_client requires two images if it is configured to use 802.15.4 radio on nRF53 SoC. If you build this sample, you must manually prepare, build, and flash matching configuration of boards/nrf/ieee802154/802154_rpmsg. Similarly, if you build any Bluetooth sample for nRF53, you must manually prepare, build, and flash matching configuration of bluetooth/hci_rpmsg to run on the Net core.

I would like multi-image builds to be able to catch such multi-core dependencies and automatically configure and build appropriate child images like:

Would such child-image configuration/build helper fit in scope of multi-image building initiative?

tejlmand commented 2 years ago

I would like multi-image builds to be able to catch such multi-core dependencies and automatically configure and build appropriate child images like: ... <cut specific examples> ... Would such child-image configuration/build helper fit in scope of multi-image building initiative?

yes, this should definitely be considered, albeit probably in a slightly adjusted way than the specific example given.

For example, it must always be possible for a user to decide not to build a given image. Even though a user enables CONFIG_BT in application on nRF5340, it could be that the user wants a different child image which provides similar functionality and thus choose not to use hci_rpmsg. Oone option in this regard could be to provide default images that can ensure a proper image for secondary cores while allowing user to still disable. This must of course be combined with a mechanism for a sample to request certain conditions to be met, else a build / configuration failure to be raised.