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

WIP: RFC: Preliminary work on flash_area open once. #1569

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

de-nordic
Copy link
Collaborator

Work in progress, although Zephyr seems to already work and flash usage has been reduced.

The function has not been in use and some ports have not been
implementing it anyway.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Variant of flash_area_get_sectors that takes flash_area object
pointer instead of flash area identifier.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The code has been modified to have single place where flash_area
area opened, at the beginning of execution.
Currently only Zephyr compiles properly and works.
close is missing.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
* of sectors filled in.
* @param ret array of sectors.
*
* Returns 0 on success, -ERANGE when there is not enough space in
Copy link
Collaborator

Choose a reason for hiding this comment

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

ERANGE looks wrong

Copy link
Member

Choose a reason for hiding this comment

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

ERANGE seems appropriate here.

Comment on lines +142 to +144
off_t fa_off = fa->fa_off;
off_t offset = 0;
size_t fa_size = fa->fa_size;
Copy link
Collaborator

Choose a reason for hiding this comment

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

fa_off and fa_size only seem to be used for reading, can't the fa structure be used directly instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it can.

Comment on lines +243 to 246
fap = flash_area_from_multi_image_slot(BOOT_CURR_IMG(state), slot);

off = BOOT_TLV_OFF(boot_img_hdr(state, slot));

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would need to check if there is any way that this function (from any call) could be passed a different value, e.g. by fault injection, because if so then the bootloader operation becomes undefined

@github-actions
Copy link

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 Jul 16, 2023
@de-nordic de-nordic removed the stale label Jul 17, 2023
Copy link

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 Jan 14, 2024
@de-nordic de-nordic removed the stale label Jan 15, 2024
Copy link

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 Jul 14, 2024
@de-nordic de-nordic removed the stale label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants