revise utralib to use features to select the SVD file

This commit is contained in:
bunnie 2022-09-26 23:24:22 +08:00
parent ac6dbb2689
commit 17248fdbf1
2 changed files with 22 additions and 11 deletions

View file

@ -7,11 +7,6 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/betrusted-io/xous-core/"
homepage = "https://betrusted.io/xous-book/"
[features]
std = []
default_features = ["std"]
# Dependency versions enforced by Cargo.lock.
[dependencies]
@ -19,4 +14,21 @@ default_features = ["std"]
svd2utra = "0.1.0"
# UTRA pre-generated version tracker
# 0.1.0 - betrusted-soc v0.9.9-7-gc809403 without performance profiling
[features]
std = []
# This specifies the SVD rev for platform targets
# Precursor is an FPGA, so the actual hardware register spec can change over time,
# hence the gitrev is specified as part of the precursor feature spec. We specify
# every gitrev that we may need to refer back to, so that we're not trying to
# map utralib version numbers to precursor soc revs -- by having the gitrev exposed,
# we can directly look up what generated the SVD file we're using without having
# to go through some manually maintained lookup table of version # to gitrev.
#
# SoCs in custom silicon would typically not need the gitrev, since their
# hardware is immutable.
precursor-c809403 = []
precursor-c809403-perflib = []
# Specify a Precusor default so that we can pass packaging CI tests.
default_features = ["std", "precursor-c809403"]

View file

@ -1,9 +1,8 @@
use std::env;
fn main() {
let svd_filename = env::var("XOUS_SVD_FILE")
.expect("Set the environment variable `XOUS_SVD_FILE` to point to an SVD file");
println!("cargo:rerun-if-env-changed=XOUS_SVD_FILE");
#[cfg(feature="precursor-c809403")]
let svd_filename = "precursor/soc-c809403.svd";
#[cfg(feature="precursor-c809403-perflib")]
let svd_filename = "precursor/soc-perf-c809403.svd";
let svd_file_path = std::path::Path::new(&svd_filename);
println!("cargo:rerun-if-changed={}", svd_file_path.canonicalize().unwrap().display());