Skip to content
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

Closed

Conversation

de-nordic
Copy link
Collaborator

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]


/*
* If code partition is selected via chosen zephyr,code-partition it should
* it should be possible to automatically detect primary and secondary
Copy link
Collaborator

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

#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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCONDARY -> SECONDARY

@de-nordic de-nordic marked this pull request as ready for review February 8, 2021 14:00
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]>
#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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?

@zephyrbot zephyrbot added the area: DFU Device Firmware Upgrade label Feb 15, 2021
@github-actions
Copy link

github-actions bot commented May 4, 2021

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.

@github-actions github-actions bot added the Stale label May 4, 2021
@github-actions github-actions bot closed this May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DFU Device Firmware Upgrade Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants