-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
dfu: mcuboot: Automatic primary/secondary image slot assignment #31715
dfu: mcuboot: Automatic primary/secondary image slot assignment #31715
Conversation
subsys/dfu/boot/mcuboot_priv.h
Outdated
|
||
/* | ||
* If code partition is selected via chosen zephyr,code-partition it should | ||
* it should be possible to automatically detect primary and secondary |
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.
it should
is here twice
subsys/dfu/boot/mcuboot_priv.h
Outdated
#if DT_NODE_EXISTS(DT_IMAGE_1_NODE) && IS_IMAGE_CODE_PARTITION(DT_IMAGE_0_NODE) | ||
#define FLASH_AREA_IMAGE_SECONDARY DT_FIXED_PARTITION_ID(DT_IMAGE_1_NODE) | ||
#elif IS_IMAGE_CODE_PARTITION(DT_IMAGE_1_NODE) | ||
#define FLASH_AREA_IMAGE_SCONDARY DT_FIXED_PARTITION_ID(DT_IMAGE_0_NODE) |
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.
SCONDARY -> SECONDARY
db86f95
to
483d097
Compare
483d097
to
2875fca
Compare
The commit adds macros that allow automatic detection and definition of FLASH_AREA_IMAGE_PRIMARY and FLASH_AREA_IMAGE_SECONDARY when DTS uses chosen zephyr,code-partition to select partition for application to run from. Signed-off-by: Dominik Ermel <[email protected]>
2875fca
to
936e13d
Compare
#if DT_NODE_EXISTS(DT_CODE_PARTITION_NODE) | ||
#define DT_IMAGE_0_NODE DT_NODE_BY_FIXED_PARTITION_LABEL(image_0) | ||
#define DT_IMAGE_1_NODE DT_NODE_BY_FIXED_PARTITION_LABEL(image_1) | ||
#define DT_IMAGE_0_NS_NODE DT_NODE_BY_FIXED_PARTITION_LABEL(image_0_nonsecure) |
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.
Will this fail for non-trustzone enabled devices where these _nonsecure
partitions are not defined?
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.
@hakonfam Yes, probably yes. It assumes that they are there.
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.
Will this fail for non-trustzone enabled devices where these
_nonsecure
partitions are not defined?
@hakonfam This shouldn't be the issue because this code only matches alternatives, so when zephyr,code-partition
is image_x
it will match the other image_y
as DFU target; when the zephyr,code-partition
is image_x_nonsecure
it will try to match image_y_nonsecure
.
If the alternative, the determined DFU partition does not exist than the DFU may no proceed anyway so compilation may and here.
The auto-code does not care about CONFIG_TRUSTED*
definition as it works on what the zephyr,code-partition
provides.
How is the zephyr,code-partition
determined when CONFIG_TRUSTED_EXECUTION_NONSECURE
is enabled?
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
The commit adds macros that allow automatic detection and definition
of FLASH_AREA_IMAGE_PRIMARY and FLASH_AREA_IMAGE_SECONDARY when
DTS uses chosen zephyr,code-partition to select partition for
application to run from.
Signed-off-by: Dominik Ermel [email protected]