Browse Source

Marks on cross build this project in README; thank you @tommythorn

That would solve issue #22
luojia65 3 years ago
parent
commit
fe7fdfd430
1 changed files with 21 additions and 0 deletions
  1. 21 0
      README.md

+ 21 - 0
README.md

@@ -6,6 +6,27 @@ RISC-V Supervisor Binary Interface ([SBI](https://github.com/riscv-non-isa/riscv
 [![Documentation](https://docs.rs/rustsbi/badge.svg)](https://docs.rs/rustsbi)
 ![License](https://img.shields.io/crates/l/rustsbi.svg)
 
+## Build this project
+
+RustSBI is usually used as a library or dependency. If you wish to, you may build RustSBI library itself using the following command:
+
+```bash
+# If you don't have the cross compile target installed, install it first
+rustup target add riscv64imac-unknown-none-elf
+# Build this project as library
+cargo build --target riscv64imac-unknown-none-elf
+```
+
+The build should finish without any errors.
+
+If you see any error like `invalid register a0: unknown register`, it's likely that you cross built this project
+into platforms other than RISC-V. RustSBI adapts to RISC-V SBI interface, you may cross build this project
+into any bare metal RISC-V platform targets.
+
+The target platform of RustSBI is usually a bare metal target. Under normal circumstances these targets in Rust
+would start with `riscv??-` and end with `-none-elf`. If a non bare metal target is built to, it would throw
+build error in `riscv` dependency crate or RustSBI library itself.
+
 ## Binary downloads
 
 RustSBI is provided with separate library and binary projects, this is the repository for RustSBI library.