Skip to content

Conversation

@madeleyneVaca
Copy link
Contributor

Related to OpenDevicePartnership/embassy-imxrt#538. This PR adds two helper functions to the NVRAM trait which makes it easy for a user to obtain the contents of an NVRAM table for validation and then clear them if found to be invalid

Copilot AI review requested due to automatic review settings January 8, 2026 23:40
@madeleyneVaca madeleyneVaca requested a review from a team as a code owner January 8, 2026 23:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Nvram trait with two helper methods to support integrity validation workflows: dump_storage for obtaining a read-only snapshot of NVRAM contents, and clear_storage for resetting storage to a default state when validation fails.

  • Added dump_storage() method to obtain a snapshot of all storage cells for validation
  • Added clear_storage() method to reset storage cells to their default state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

williampMSFT
williampMSFT previously approved these changes Jan 9, 2026
Copy link
Contributor

@williampMSFT williampMSFT left a comment

Choose a reason for hiding this comment

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

May want to check if copilot is right on the copy thing, I'm not 100% sure, but other than that, looks good to me

@madeleyneVaca madeleyneVaca merged commit 4dadf27 into OpenDevicePartnership:main Jan 9, 2026
10 checks passed
madeleyneVaca added a commit to OpenDevicePartnership/embassy-imxrt that referenced this pull request Jan 9, 2026
…by OEMs (#538)

In the event that an OEM is using the RTC NVRAM table for something more
complicated than a few flags, integrity validation becomes necessary.
The `storage()` API in the `Nvram` trait returns a mutable reference and
ensures we can't double borrow. Great for safety but makes it difficult
to get the values for validation (and potential erasure if invalid) and
then also deconstruct the NVRAM table, so that they can be passed off
the values to whichever service needs them, as that would constitute a
double borrow.

This PR introduces two helper functions which 1) dumps the current u32
values of the registers, rather than allowing for another handle to the
RTC peripheral. The OEM can then perform their validation logic and if
something is iffy, they can 2) erase the contents of the table through
the object that has the handle before splitting up the entries as the
OEM desires.


Related PRs:
OpenDevicePartnership/embedded-mcu#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants