add renode as a target to utralib

This commit is contained in:
bunnie 2022-09-27 18:09:33 +08:00
parent 4f2506f009
commit d0dc2e2a9f
6 changed files with 5986 additions and 29 deletions

2
utralib/Cargo.lock generated
View file

@ -120,7 +120,7 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "utralib" name = "utralib"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"svd2utra", "svd2utra",
] ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "utralib" name = "utralib"
version = "0.1.1" version = "0.1.2"
authors = ["Sean Cross <sean@xobs.io>", "bunnie <bunnie@kosagi.com>"] authors = ["Sean Cross <sean@xobs.io>", "bunnie <bunnie@kosagi.com>"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -41,6 +41,7 @@ precursor-c809403-perflib = []
# checks inside build.rs to ensure consistency. # checks inside build.rs to ensure consistency.
precursor = [] precursor = []
hosted = [] hosted = []
renode = []
# Specify a Precusor default so that we can pass packaging CI tests. # Specify a Precusor default so that we can pass packaging CI tests.
default = ["precursor-c809403", "precursor"] default = ["precursor-c809403", "precursor"]

View file

@ -20,12 +20,25 @@ fn main() {
)] )]
panic!("Precursor target specified, but no corresponding gitrev specified"); panic!("Precursor target specified, but no corresponding gitrev specified");
// this list grows O(N) as we add more targets. :-/ I don't know of a better way
// to express "only one of N should be selected" using cfg syntax
#[cfg(all( #[cfg(all(
feature="precursor", feature="precursor",
feature="hosted" any(feature="hosted", feature="renode")
))]
panic!("Multiple targets specified. This is disallowed");
#[cfg(all(
feature="hosted",
any(feature="precursor", feature="renode")
))]
panic!("Multiple targets specified. This is disallowed");
#[cfg(all(
feature="renode",
any(feature="precursor", feature="hosted")
))] ))]
panic!("Multiple targets specified. This is disallowed"); panic!("Multiple targets specified. This is disallowed");
// also grows O(N) as we add more gitrevs
#[cfg(all( #[cfg(all(
feature="precursor-c809403", feature="precursor-c809403",
feature="precursor-c809403-perflib" feature="precursor-c809403-perflib"
@ -43,9 +56,16 @@ fn main() {
#[cfg(feature="precursor-c809403-perflib")] #[cfg(feature="precursor-c809403-perflib")]
let generated_filename = "src/generated/precursor_perf_c809403.rs"; let generated_filename = "src/generated/precursor_perf_c809403.rs";
#[cfg(feature="renode")]
let svd_filename = "renode/renode.svd";
#[cfg(feature="renode")]
let generated_filename = "src/generated/renode.rs";
// ----- control file generation and rebuild sequence ----- // ----- control file generation and rebuild sequence -----
// check and see if the configuration has changed since the last build. This should be // check and see if the configuration has changed since the last build. This should be
// passed by the build system (e.g. xtask) if the feature is used. // passed by the build system (e.g. xtask) if the feature is used.
#[cfg(not(feature="hosted"))]
{
let last_config = out_dir().join("../../LAST_CONFIG"); let last_config = out_dir().join("../../LAST_CONFIG");
if last_config.exists() { if last_config.exists() {
println!("cargo:rerun-if-changed={}", last_config.canonicalize().unwrap().display()); println!("cargo:rerun-if-changed={}", last_config.canonicalize().unwrap().display());
@ -74,3 +94,15 @@ fn main() {
.unwrap(); .unwrap();
write!(svd_file, "utralib/{}", svd_filename).unwrap(); write!(svd_file, "utralib/{}", svd_filename).unwrap();
} }
#[cfg(feature="hosted")]
{
let svd_path = out_dir().join("../../SVD_PATH");
let mut svd_file = OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.open(svd_path)
.unwrap();
write!(svd_file, "").unwrap(); // there is no SVD file for hosted mode
}
}

View file

@ -12,6 +12,11 @@ mod precursor_perf_c809403;
#[cfg(feature="precursor-c809403-perflib")] #[cfg(feature="precursor-c809403-perflib")]
pub use precursor_perf_c809403::*; pub use precursor_perf_c809403::*;
#[cfg(feature="renode")]
mod renode;
#[cfg(feature="renode")]
pub use renode::*;
// Hosted mode includes nothing, as it relies on the abstract host // Hosted mode includes nothing, as it relies on the abstract host
// architecture for I/O; so this file is empty when the "hosted" // architecture for I/O; so this file is empty when the "hosted"
// configuration is selected and there are no corresponding "hosted" // configuration is selected and there are no corresponding "hosted"

File diff suppressed because it is too large Load diff