diff --git a/difftest/default.nix b/difftest/default.nix index 9e2c547698..69ceda1960 100644 --- a/difftest/default.nix +++ b/difftest/default.nix @@ -1,4 +1,5 @@ { lib +, libspike , callPackage , elaborateConfig @@ -45,6 +46,8 @@ let env = { VERILATED_INC_DIR = "${verilated}/include"; VERILATED_LIB_DIR = "${verilated}/lib"; + SPIKE_LIB_DIR = "${libspike}/lib"; + SPIKE_INTERFACES_LIB_DIR = "${spike_interfaces}/lib"; DESIGN_VLEN = elaborateConfig.parameter.vLen; DESIGN_DLEN = elaborateConfig.parameter.dLen; }; diff --git a/difftest/spike_rs/build.rs b/difftest/spike_rs/build.rs new file mode 100644 index 0000000000..be5a213b2f --- /dev/null +++ b/difftest/spike_rs/build.rs @@ -0,0 +1,13 @@ +use std::env; + +fn main() { + println!("cargo::rustc-link-search=native={}", env::var("SPIKE_LIB_DIR").expect("SPIKE_LIB_DIR should be set")); + println!("cargo::rustc-link-lib=static=riscv"); + println!("cargo::rustc-link-lib=static=softfloat"); + println!("cargo::rustc-link-lib=static=disasm"); + + println!("cargo::rustc-link-search=native={}", env::var("SPIKE_INTERFACES_LIB_DIR").expect("SPIKE_INTERFACES_LIB_DIR should be set")); + println!("cargo::rustc-link-lib=static=spike_interfaces"); + + println!("cargo::rerun-if-env-changed=VERILATED_LIB_DIR"); +}