Xous SDK (pinned for betrusted transpilation)
Find a file
2020-10-14 01:56:40 +08:00
.cargo xtask: add cargo xtask command 2020-08-17 19:42:39 +08:00
docs ThreadID: rename from CtxID 2020-07-16 11:04:31 +08:00
emulation utra: move example.svd to emulation 2020-10-05 10:52:43 +08:00
examples forgot to add debug.rs for graphics-server 2020-10-14 01:56:40 +08:00
kernel intermediate progress on debugging return messages 2020-10-14 01:28:10 +08:00
loader fix more UTRA issues; migrate to dual-UART for kernel/console messages 2020-10-13 05:22:19 +08:00
macros hosted: fix hosted builds 2020-08-18 13:52:43 +08:00
svd2utra add 32-bit field width option 2020-10-12 16:54:03 +08:00
tools create-image: support generating an image from an svd 2020-10-05 11:37:44 +08:00
utralib utralib: fix build dependency on svd file 2020-10-13 14:18:00 +08:00
xous-rs intermediate progress on debugging return messages 2020-10-14 01:28:10 +08:00
xtask Merge branch 'master' of https://github.com/betrusted-io/xous-core into ticktimer 2020-10-13 04:15:01 +08:00
.gitattributes initial commit 2020-03-10 12:13:05 +08:00
.gitignore gitignore: don't ignore utra anymore 2020-10-05 10:35:42 +08:00
buildpush.sh fix more UTRA issues; migrate to dual-UART for kernel/console messages 2020-10-13 05:22:19 +08:00
Cargo.lock debugging ticktimer 2020-10-13 22:49:12 +08:00
Cargo.toml attempt to add a ticktimer server 2020-10-12 19:08:16 +08:00
CODE_OF_CONDUCT.md initial commit 2020-03-10 12:13:05 +08:00
CONTRIBUTING.md initial commit 2020-03-10 12:13:05 +08:00
README.md Update README.md 2020-09-26 02:01:48 +08:00
start-gdb.sh add a helper script to boot kernel gdb session 2020-09-26 01:41:55 +08:00

Xous Core

Core files for the Xous microkernel operating system.

This repository contains everything necessary to build the Xous kernel from source. It consists of the following projects:

  • kernel: core memory manager, irq manager, and syscallhandler
  • loader: initial loader used to start the kernel
  • tools: programs used to construct a final boot image
  • docs: documentation on various aspects of Xous
  • emulation: Renode scripts used to emulate Xous
  • xous-rs: userspace library

Generating an image

You can build all Xous packages by running:

$ rustup target add riscv32imac-unknown-none-elf
$ cargo build --target riscv32imac-unknown-none-elf
$ cd kernel
$ cargo build -p kernel --target riscv32imac-unknown-none-elf
$ cd ..
$ cd loader
$ cargo build -p loader --target riscv32imac-unknown-none-elf
$ cd ..

This will compile all runtime packages for riscv32imac-unknown-none-elf. Note that the kernel and loader must currently be built separately, due to the fact that they have custom linker scripts.

These need to be packaged into a loadable binary. You can generate such a binary by running the following:

$ cargo run -p tools --bin create-image -- \
        --csv emulation/csr.csv \
        --kernel kernel/target/riscv32imac-unknown-none-elf/debug/kernel \
        --init target/riscv32imac-unknown-none-elf/debug/shell \
        target/args.bin

Targeting Real Hardware

The following files need manual adjustment:

  • emulation/csr.csv should map to the csr.csv of the final SoC
  • examples/graphics-server/src/backend/betrusted.rs needs a correct address for the "control" data structure (based on csr.csv)
  • kernel/src/debug.rs:7 needs a correct UART base, based on csr.csv
  • loader/src/debug.rs:31 needs a correct UART base, based on csr.csv
  • kernel/src/main.rs:67 needs a corret UART base, based on csr.csv

Create the loader.bin from the .elf. objcopy adds several hundred megabytes of zero at the end of loader.bin so just take the first 64kiB, which is the exact size allocated for it anyways in hardware. The final loadable image is created by cating the loader and the kernel together.

riscv64-unknown-elf-objcopy loader/target/riscv32imac-unknown-none-elf/release/loader -O binary loader_raw.bin
dd if=loader_raw.bin of=loader.bin bs=1024 count=64
cat loader.bin target/args.bin > xous.img

The image should be written to location 0x2050_0000 (SPI ROM offset 0x50_0000), using the provision-xous.sh script inside betrusted-scipts running on a Betrusted provisioning harness, that is a Raspberry Pi 4 with the appropriate debug hat attached, and the Precursor hardware plugged into the debug hat. You can also check out the dvt-hardware branch for the WIP integration of all the above commands.

Try It Out on a Desktop

Clone this repository, and run

cargo xtask run