Ver Fonte

This package should be built into RISC-V targets

luojia65 há 3 anos atrás
pai
commit
1b3c56f679
2 ficheiros alterados com 7 adições e 0 exclusões
  1. 2 0
      CHANGELOG.md
  2. 5 0
      src/lib.rs

+ 2 - 0
CHANGELOG.md

@@ -9,6 +9,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ### Added
 
+- Note in code compilation that this package should be built into RISC-V targets
+
 ### Modified
 
 ## [0.2.1] - 2022-02-14

+ 5 - 0
src/lib.rs

@@ -179,6 +179,11 @@ mod timer;
 
 mod util;
 
+// RustSBI only supports RISC-V; raise error if built into non RISC-V targets.
+#[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
+compile_error!("not RISC-V RV32 or RV64 targets! RustSBI only supports RISC-V, it's likely that the package is cross built into targets other than RISC-V.
+Use parameter like `--target riscv64imac-unknown-none-elf` and try again.");
+
 const SBI_SPEC_MAJOR: usize = 0;
 const SBI_SPEC_MINOR: usize = 3;