2020-03-10 04:04:17 +00:00
# Xous Core
2025-11-19 05:09:02 +00:00
Xous is a microkernel operating system written in pure Rust, built for high-assurance applications.
Key features:
- Hardware memory protection
- Virtual memory via MMU
- Each process has an isolated address space
- `std` support in stable Rust (tier-3 Rust target)
- Asynchronous message passing
- Minimal code base
- [Microkernel ](./kernel ) architecture
- System [services ](./services ) live in userland
- Targeted at high-assurance embedded applications
2020-03-10 04:04:17 +00:00
2025-10-07 17:16:45 +00:00
The [Xous Book ](https://betrusted.io/xous-book/ ) covers the architecture and structure of the kernel.
2021-01-21 17:53:57 +00:00
2025-10-07 17:16:45 +00:00
The [wiki ](https://github.com/betrusted-io/betrusted-wiki/wiki ) is a community resource that answers many FAQ.
2025-02-20 07:04:56 +00:00
2025-11-25 11:06:16 +00:00
The [Baochip README ](./README-baochip.md ) is the starting point for Baochip users. `vscode` users may wish to install the `baochip` extension to help manage build & test cycles.
2020-03-10 04:04:17 +00:00
2025-10-07 17:16:45 +00:00
The [Precursor README ](./README-precursor.md ) is the starting point for Precursor users.
2020-03-10 06:45:18 +00:00
2025-10-07 17:16:45 +00:00
Xous is a mono-repo project. It contains the kernel, libraries, applications, and tools necessary to build full device images. Here is a brief description of the more important directories:
2020-03-10 06:45:18 +00:00
2025-10-07 17:16:45 +00:00
* **api**: "Secular" API libraries - minimal-dependency, common-core APIs used by core Xous services
* **apps**: Precursor applications
* **apps-dabao**: Dabao applications
* **apps-baosec**: Baosec applications
* **bao1x-boot**: Bao1x secure boot chain
* **baremetal**: Baremetal target - runs after the boot chain, for developers that don't want Xous but can still use Xous' `no-std` features
* **emulation**: Renode scripts used to emulate Xous
* **imports**: Vendored-in libraries that had to be forked for Xous compatibility
* **kernel**: core memory manager, irq manager, and syscall implementations.
* **libs**: Device driver libraries. The common thread is that none of these code bases contain a `main.rs` , just a `lib.rs` .
* **loader**: Sets up virtual memory space and boots the kernel
* **locales**: Tools for handling internationalization
* **signing**: Scripts for generating signed images
* **services**: Xous programs that support Xous apps. Middleware, if you will.
* **svd2utra**: A program for converting SVD chip descriptions in XML to the UTRA "header file" format
* **tools**: Programs used to construct a final boot image. Also the home of various diagnostic and test utilities.
* **utralib**: The [Unambigous Thin Register Abtraction ](./utralib/README.md ). The core hardware interface for Xous.
* **xous-ipc**: Inter-process communication convenience APIs for Xous
* **xous-rs**: API files for the kernel. Where the syscall interfaces live.
* **xtask**: The build system manager for Xous.
2020-09-25 09:11:52 +00:00
2025-10-07 17:16:45 +00:00
## Dependencies
2020-09-25 09:11:52 +00:00
2025-10-07 17:16:45 +00:00
Install the latest [Rust ](https://rust-lang.org/tools/install/ ) or run `rustup update` to update your Rust installation prior to building. Xous development assumes a recent version of Rust.
2020-09-25 09:11:52 +00:00
2025-10-07 17:16:45 +00:00
## Build Commands
2020-09-25 09:16:44 +00:00
2025-10-07 17:16:45 +00:00
- Precursor: `cargo xtask app-image`
- Dabao: `cargo xtask dabao`
- Baosec: `cargo xtask baosec`
- Baochip baremetal: `cargo xtask baremetal-bao1x`
2020-11-03 12:41:37 +00:00
2025-10-07 17:16:45 +00:00
Additional apps to be bundled into images can be specified as extra arguments on the command line, e.g. `cargo xtask dabao helloworld` will generate a Dabao image that includes `helloworld` in the detached-app section. Features, app-features, loader-features, and so forth can also be passed as command line arguments; run `cargo xtask` on its own for more help.
2020-11-03 12:41:37 +00:00
2025-10-07 17:16:45 +00:00
## Emulation
2022-11-03 15:06:20 +00:00
2025-10-07 17:16:45 +00:00
- `cargo xtask run` will bring up an emulated Precursor
- `cargo xtask baosec-emu` will bring up an emulated Baosec
- `cargo xtask renode-image` will build an image suitable for [Renode ](https://renode.io/#downloads ) emulation of a Precursor target. Start renode by running `renode emulation/xous-release.resc`
2020-11-03 12:41:37 +00:00
2025-10-07 17:16:45 +00:00
## Building Documentation
A flag of `--feature doc-deps` must be passed when running `cargo doc` , like this:
2020-09-25 09:16:44 +00:00
2025-10-07 17:16:45 +00:00
`cargo doc --no-deps --feature doc-deps`
2022-11-03 15:28:08 +00:00
2025-10-07 17:16:45 +00:00
`doc-deps` is a dummy hardware target that satisfies the requirement of
a "board" when building documentation.
2022-11-03 15:28:08 +00:00
2025-10-07 17:16:45 +00:00
## Local-vs-crates.io Verification
2022-11-03 15:06:20 +00:00
2025-10-07 17:16:45 +00:00
`xtask` does a check every build to ensure that any `crates.io` dependencies
are synchronized with the contents of the monorepo. It protects against the
scenario where you edited a crate that exists in the Xous repo, but the
build system ignores the local edits because it's fetching an old version from
`crates.io` .
2022-11-03 15:28:08 +00:00
2025-10-07 17:16:45 +00:00
Developers working on published crates should patch them in the root `Cargo.toml`
file and bypass the check with `--no-verify` .
2022-11-18 10:19:57 +00:00
## Acknowledgement
This project is funded through the NGI0 PET Fund, a fund established by NLnet
with financial support from the European Commission's Next Generation Internet
programme, under the aegis of DG Communications Networks, Content and Technology
under grant agreement No 825310.
< table >
< tr >
< td align = "center" width = "50%" > < img src = "https://nlnet.nl/logo/banner.svg" alt = "NLnet foundation logo" style = "width:90%" > < / td >
< td align = "center" > < img src = "https://nlnet.nl/image/logos/NGI0_tag.svg" alt = "NGI0 logo" style = "width:90%" > < / td >
< / tr >
2023-03-23 02:28:44 +00:00
< / table >