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

subsys: settings: nvs: provisioning of settings images #79130

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fgrandel
Copy link
Contributor

The main purpose of this PR is to prepare provisioning of independently built settings flash images. It allows users to provision arbitrary per-device settings independently of the application binary, e.g. at the end of the production line or during an OTA update.

The PR provides an integration test environment to simulate separately built images for the NVS settings subsystem on the QEMU x68 board. This will allow users to experiment with independently provisioned settings partitions on QEMU. They can either use a provided sample partition or extract their own binary partition image from a user-provided test device:

  • It adds a reserved memory region to the QEMU x86 board and places fixed simulated flash partitions inside that region mapped to their own linker section. The linker section is added to the x86 MMU pagetable (via gen_mmu.py) to support access under memory protection.
  • It enables the flash simulator to access flash at a well-defined pre-configured addres in the reserved memory region. This will allow us to simulate pre-provisioned flash with QEMU (or any other application using the flash simulator). This feature is enabled through an independent Kconfig variable that also enforces that the memory region will be statically reserved.
  • Finally the PR adds an appropriate overlay, sample flash partition image, code and additional instructions to the settings sample.

In a later PR I'll contribute a python generator script which allows to generate arbitrary NVS settings images from a YAML configuration file. I'm splitting the contribution into multiple parts for easier reviewing across different subsystems.

This PR depends on #79084 and #79086 to be merged first.

The flash simulator assumes that flash is being addressed with absolute
addresses by clients. But this is not the case. Given addresses are
relative to the flash base address.

The existing code only worked because the base address was always zero.
Testing with non-zero base addresses caused a mem fault/page fault.

(Reproducible e.g. when using the NVS settings subsystem on QEMU x86
with a non-zero base address in the soc-nv-flash node.)

Fixes zephyrproject-rtos#79082

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Generating sections via DT memory attributes did not work for the
platform as only the memory region was created so far.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change adds a reserved mapped memory region to the QEMU x86 board
and places fixed simulated flash partitions inside that region mapped to
its own linker section in the final ELF file. The section is then added
to the pagetable to support access even if memory protection is active.

The change places the simulated flash at a well-defined memory address
rather than in the common .bss section.

The rationale behind this approach is, that then the contents of the
simulated flash can be pre-provisioned via a separate raw binary or
Intel hex image to qemu (or any other application using simulated flash)
independently from the kernel image.

This will be used in a later PR to exemplify pre-provisioned settings
partitions with the NVS settings backend.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Enables the flash simulator to simulate pre-provisioned flash with QEMU
(or any other application using the flash simulator).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Adds an overlay, code and documentation to the sample that allows user
to test an independently provisioned settings partition on QEMU.

Also provides instructions how to achieve the same on real devices.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants