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

Poc: persistant storage #298

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

Poc: persistant storage #298

wants to merge 27 commits into from

Conversation

dehanj
Copy link
Member

@dehanj dehanj commented Nov 14, 2024

Description

Draft PR, WIP. Some parts of this are still to be considered as a proof of concept.
TODO: write a better description

Type of change

Please tick any that are relevant to this PR and remove any that aren't.

  • Bugfix (non breaking change which resolve an issue)
  • Feature (non breaking change which adds functionality)
  • Breaking Change (a change which would cause existing functionality to not work as expected)
  • Documentation (a change to documentation)

Submission checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my changes
  • I have tested and verified my changes on target
  • My changes are well written and CI is passing
  • I have squashed my work to relevant commits and rebased on main for linear history
  • I have added a "Co-authored-by: x" if several people contributed, either pair programming or by squashing commits from different authors.
  • I have updated the documentation where relevant (readme, dev.tillitis.se etc.)
  • QEMU is updated to reflect changes

@dehanj dehanj mentioned this pull request Nov 14, 2024
10 tasks
@dehanj
Copy link
Member Author

dehanj commented Nov 14, 2024

Comment from mc in previous PR (#273)

I have tested the firmware in a patched qemu running in firmware mode all the time. I tried the management app, installed preloaded app, started it, and watched the partition table while all this was happening. The syscalls seem to work fine.

I was a bit surprised that the preloaded app wasn't started automatically but I understand that part isn't implemented yet. Perhaps it's good to wait, because I think it's still unclear (#214) how we even would signal back to the firmware how not to start the preloaded app. On the other hand, perhaps now is the time to experiment with different solutions?

There are more things that aren't yet implemented. The TODO notes are fine, of course, but they're often just shorthand notes and doesn't explain what more needs to be done. I suggest we track these things in issues or just tasks in an issue, but at least flesh them out a little.

Since the current PoC just reuses the BLAKE2S MMIO to get to the firmware syscall handler it requires support in the hardware to watch PC all the time and raise the privelege when PC hits the blessed address stored in BLAKE2S. I'm worried about if this solution is possible to do in the hardware design without changing PicoRV32. It's certainly not easy to emulate in qemu.

I looked a lot in qemu and did some experiments with the other suggestion in #234, that is to write something to an MMIO to trigger the syscall. That is certainly easier to catch in both hardware and qemu, even if affecting PC directly might still be unsolved.

@dehanj dehanj force-pushed the persistant_storage_fw_ branch from a32be6f to b7ba452 Compare November 19, 2024 12:29
@dehanj dehanj linked an issue Nov 19, 2024 that may be closed by this pull request
@dehanj dehanj force-pushed the persistant_storage_fw_ branch from b7ba452 to cc0621f Compare November 21, 2024 08:57
PoC of how a syscall could look like.
- Have only one transfer function, to minimize duplicate code.
- Remove address assignments that does not make a difference.
Add an erase command to let the user have more control over the
allocated area. This will also be more familiar to embedded developers.
As a bonus it minimizes the logic needed in firmware, and in theory we
can now increase the current write limit of one sector.
dehanj and others added 3 commits December 9, 2024 09:01
- Use new syscall API from hw
- 4 byte align the syscall function
- Restore blake2s
- Remove setting system_mode_ctrl since it is done by the hardware instead

Co-authored-by: Mikael Ågren <[email protected]>
@dehanj dehanj force-pushed the persistant_storage_fw_ branch from cc0621f to 8c073c3 Compare December 9, 2024 08:02
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.

fw: Persistent storage syscalls
1 participant