Skip to content

Add new utils for descriptors#11

Merged
madeleyneVaca merged 2 commits into
OpenDevicePartnership:mainfrom
madeleyneVaca:personal/mavaca/add_app_utils
Jun 11, 2025
Merged

Add new utils for descriptors#11
madeleyneVaca merged 2 commits into
OpenDevicePartnership:mainfrom
madeleyneVaca:personal/mavaca/add_app_utils

Conversation

@madeleyneVaca
Copy link
Copy Markdown
Contributor

@madeleyneVaca madeleyneVaca commented Jun 9, 2025

If an EC configures the flexspi during application code, memory mapped reads like are done in get_active_slot and get_app_at_slot may not return the proper data. This commit adds utils to get the necessary info to be able to read the right section of memory into a buffer(s) (not memory mapped; i.e. something like a flash driver) and then construct the descriptors directly from the buffer(s).

If an EC configures the flexspi during application code, memory mapped reads like are done in get_active_slot and get_app_at_slot may not return the proper data. This commit adds utils to get the app slot number and the app descriptors base address. Application code can read the descriptor region into a buffer and then use AppImageDescriptor::from_region with that buffer and the slot number
@madeleyneVaca madeleyneVaca force-pushed the personal/mavaca/add_app_utils branch from d803a92 to 6278f0d Compare June 9, 2025 16:55
Comment thread src/lib.rs
@madeleyneVaca madeleyneVaca force-pushed the personal/mavaca/add_app_utils branch from f7e5fdd to 8c4d25b Compare June 10, 2025 18:23
JamesHuard
JamesHuard previously approved these changes Jun 10, 2025
Copy link
Copy Markdown
Contributor

@JamesHuard JamesHuard left a comment

Choose a reason for hiding this comment

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

think you've got some clippy warnings around documentation

Adds from_region to allow a user to build the boot descriptors from a provided buffer instead of utilizing memory-mapped reads at an address. This is useful in case application code has already configured the flexspi module as not all configs will read bits in the same was as the FCB. Because of the pointer arithmetic in locating the app descriptors, this function is considered unsafe as special care MUST be given to the buffer argument to avoid invalid memory access.
Adds from_header_and_app_regions to allow a user to build the boot descriptors from two small buffers containing the bytes for the header and the bytes for the app descriptors separately. This is useful in case these chunks are not contiguous in memory.
@madeleyneVaca madeleyneVaca force-pushed the personal/mavaca/add_app_utils branch from d598e9e to a79470d Compare June 10, 2025 23:23
@madeleyneVaca madeleyneVaca merged commit 492d0d9 into OpenDevicePartnership:main Jun 11, 2025
16 checks passed
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.

4 participants