MCPcopy Index your code
hub / github.com/betrusted-io/xous-core

github.com/betrusted-io/xous-core @v0.10.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.10.1 ↗ · + Follow
15,732 symbols 53,709 edges 1,513 files 3,314 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Getting started with Precursor

Quickstart using Hosted Mode

You can try out Xous in a "hosted mode" wherein programs are compiled for your native platform and are run locally as processes within your current operating system. System calls are replaced with network calls to a kernel that simply shuffles messages around.

Xous uses the xtask convention, where various complex build commands are stored under cargo xtask. This allows for us to create arbitrarily complex build sequences without resorting to make (which is platform-dependent), sh (which requires a lot of external tooling), or another build system.

To build a set of sample programs and run them all using the kernel for communication, clone this repository and run:

cargo xtask run

This will build several servers and a "shell" program to control them all. Most notably, a graphics-server will appear and kernel messages will begin scrolling in your terminal.

Hosted Mode UI navigation

Precursor Host
D-pad middle button Home
D-pad up up arrow
D-pad down down arrow
D-pad left left arrow
D-pad right right arrow

Quickstart using an emulator

Xous uses Renode as the preferred emulator, because it is easy to extend the hardware peripherals without recompiling the entire emulator.

Due to a breaking change in Renode, this codebase is only compatible with Renode equal to or later than 1.15.2.7965 (e6e79aad-202408180425)

Download Renode and ensure it is in your path. For now, you need to download the nightly build, until DecodedOperation is included in the release.

Then, build Xous:

cargo xtask renode-image

This will compile everything in release mode for RISC-V, compile the tools require to package it all up, then create an image file.

Finally, run Renode and specify the xous-release.resc REnode SCript:

renode emulation/xous-release.resc

Renode will start emulation automatically, and will run the same set of programs as in "Hosted mode".

Generating a hardware image

To build for real hardware, you must specify an .svd file. This file is generated by the SoC build process and describes a single Betrusted core. These addresses will change as hardware is modified, so if you distribute a modified Betrusted core, you should be sure to distribute the .svd file.

The UTRA abstracts the details of the register locations, by wrapping them in logical names that don't change. For Precursor, the SVD files are tracked inside utralib/precursor/soc-<gitref>.svd. Since each soc.svd can potentially change with a git reference, a gitref is coded into the filename by convention.

Generally, one can create an image for hardware using the following command:

cargo xtask app-image-xip

And it will pull from the default soc.svd configuration.

The currently selected config is set by the constant PRECURSOR_SOC_VERSION in xtask/src/main.rs; it is one of the first constants near the top.

If you have built your own custom soc.svd file, the most convenient way to update to this is to simply replace the file referenced in the default with yours, and then run cargo build inside the utralib directory (not in the Xous root -- the build command must happen inside the directory to force a regeneration of the generated UTRA bindings). This will likely result in a complaint when you run xtask that your local tree does not match what is checked into git; if you are building from your own configuration, that is correct, and thus you should add --no-verify to your xtask command to suppress the check.

Note that adding a full extra custom gitrev is more involved, it involves editing the utralib/Cargo.toml and utralib/build.rs to reference your new artifact as a brand new feature flag.

The resulting images are in your target directory (typically target/riscv32imac-unknown-xous-elf/release/) with the names xous.img (for the kernel) and loader.bin (for its bootloader). The corresponding gateware is in precursors/soc_csr-<gitref>.bin. These can be written to your device by following the update guide.

Extension points exported contracts — how you extend this code

Identity (Interface)
Trait for getting the identity element of a point type. [14 implementers]
bao1x-boot/curve25519-dalek-bao1x/src/traits.rs
ShellCmdApi (Interface)
////////////////////// Common items to all commands [8 implementers]
apps/mtxcli/src/cmds.rs
ShellCmdApi (Interface)
////////////////////// Common items to all commands [7 implementers]
services/cram-console/src/cmds.rs
ShellCmdApi (Interface)
////////////////////// Common items to all commands [10 implementers]
services/bao-console/src/cmds.rs
ShellCmdApi (Interface)
////////////////////// Common items to all commands [27 implementers]
services/shellchat/src/cmds.rs
IpcSafe (Interface)
Xous supports sending Messages from Clients to Servers. If a message is a `MemoryMessage`, then the Server may respond b [21 …
libs/flatipc/src/lib.rs
PackedBytes (Interface)
Trait that enables endian aware conversion to/from bytes for packable types Mostly for primitives. Currently expected t [14 …
libs/mass-storage/packing/packing/src/packed.rs
UdmaWidths (Interface)
Constrain potential types for UDMA words to only what is representable and valid for the UDMA subsystem. [6 implementers]
libs/bao1x-api/src/udma.rs

Core symbols most depended-on inside this repo

unwrap
called by 7294
apps/vault/src/ctap/storage.rs
push
called by 1145
services/gam/src/api.rs
iter
called by 1065
loader/src/args.rs
unwrap
called by 796
apps-baosec/vault2/src/ctap/storage.rs
wo
called by 599
libs/bao1x-hal/src/shared_csr.rs
iter_mut
called by 586
libs/flatipc/src/vec.rs
to_usize
called by 582
xous-rs/src/definitions.rs
len
called by 568
services/xous-log/src/cursor.rs

Shape

Method 8,183
Function 4,889
Class 1,687
Enum 837
Interface 118
Struct 15
TypeAlias 3

Languages

Rust92%
Python4%
C#3%
C1%
Go1%
C++1%

Modules by API surface

apps/vault/src/ctap/mod.rs120 symbols
apps-baosec/vault2/src/ctap/mod.rs120 symbols
libs/bao1x-hal/src/usb/driver.rs113 symbols
bao1x-boot/curve25519-dalek-bao1x/src/edwards.rs108 symbols
libs/bao1x-hal/src/lis2dh12.rs104 symbols
utralib/src/generated/bao1x.rs101 symbols
utralib/src/generated/precursor_perf.rs97 symbols
bao1x-boot/curve25519-dalek-bao1x/src/scalar.rs93 symbols
apps/vault/src/ctap/client_pin.rs92 symbols
apps-baosec/vault2/src/ctap/client_pin.rs92 symbols
libs/xous-pio/src/lib.rs89 symbols
services/root-keys/src/implementation.rs87 symbols

For agents

$ claude mcp add xous-core \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page