-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The allow Rust code to run in userspace, several things will have to be done:
- BASIC: Allow
CONFIG_USERSPACE
to be defined, but require all threads running Rust code to be in system mode. Implementing this is a matter of documentation, and removing the current build-time check againstCONFIG_USERSPACE
being defined. - FULL: To allow rust code to run in userspace several things need to be done:
- The mechanisms implementing atomics and spinlocks will have to have alternate implementations that work with userspace mechanisms. Atomics might be usable in a platform dependent way (some platforms use only intrinsic atomic instructions and allow barriers to be used from userspace). Critical sections would likely have to be implemented using a Mutex. There will likely be a performance hit due to this implementation, and it should only be used when specifically requested by Kconfig.
- Userspace in Zephyr requires all primitive objects be declared statically, and be placed in specific link sections. Currently, Zephyr primitives are bundled with an atomic to enforce correct initialization. This would have to be rethought, so that the actual zephyr object would be by itself in its own linker section, and the Rust-side object would contain a reference to it. There would be a memory use increase, and a performance penalty, due to the additional deference needed for these types. In addition, compound objects that contain these primitives would have to be reworked to support these declarations as well.
- Any interfaces that use callbacks will need a different mechanism. This mostly impacts async code.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Todo