-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Using zephyr,code-partition for correct generation of image code location and size #31487
Comments
@mbolivar-nordic, @galak, @ioannisg, @de-nordic, fyi. |
What part of the build system is moving around the |
An overlay file of course. |
And how is that overlay file being selected? The point is that overlays are set in CMake or from the command line, which was my comment on the other thread. |
From the command line indeed, and what is the problem with that, just add By setting the All other (more advanced) usages use an overlay file to override the default code partition, without any Kconfig symbol. Support for whatever bootloader/partitioning scheme is supported by a appropiate dts (if the default does not fit) and a overlay for selecting the correct location. A further extension could be to use linker generated memory regions for the parent of the code-partition, in that case the image would have access to its header (and possibly trailer for bootloaders that use trailers to verify images). The proposal does all this by just using the tools in a correct way. Removing the confusing (Kconfig) generation of image headers, avoiding the need to add extra Kconfig options for other kind of images that need to be generated (these extra Kconfig definitions are only trying to describe extra info not included in the dts). In all cases the image size is correctly evaluated against the area that is used. It only takes a change in the dts describing the partitions how they are really used. |
It is not necessarily a problem, its just a change from the current setup where selecting One concern is that specifying the overlay file is rather clunky. Either you need a Something like |
The overlay file is very simple:
and could reside in the project folder, but yes it would change the usage of
Yes, this would be very clean. It is possible to add a mcuboot_boot, mcuboot_image, ... to the board definitions with just the above overlay file. But this might limit the ability to add board revisions. |
The |
Is your enhancement proposal related to a problem? Please describe.
At the moment it is possible to generate images for a specific partition by using zephyr,code-partition = &partition in the dts.
However it is not possible to specify the size of the header. This is specified by e.g. selecting CONFIG_USE_MCUBOOT = y,
this selects
CONFIG_USE_DT_CODE_PARTITION=y
and introduces a header size.If the partitions are specified in more detail the correct code partition could be specified and there would be no Kconfig specification. Suppose USE_DT_CODE_PARTITION would be always selected (or at least if a chosen code-partition is defined) and the partition definition is:
Note that there are no partitions that are overlapping.
To generate a image that would not touch the storage partition:
zephyr,code-partition = @image_partition
.To generate the mcu bootloader image:
zephyr,code-partition = @boot_partition
.To generate a chainloader image in slot0:
zephyr,code-partition = @slot0_partition
.To generate a mcuboot loadable image for slot0:
zephyr,code-partition = @slot0_image_partition
.To generate a mcuboot xip loadable image for slot1:
zephyr,code-partition = @slot1_image_partition
.Describe alternatives you've considered
Alternative solutions have been proposed in #27974 and #31073 (side benefit).
This proposal replaces #31400.
The text was updated successfully, but these errors were encountered: