mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
xtask: regenerate repl file as part of renode-image
Use `svd2repl` to generate the Renode platform file. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
659f5b7f68
commit
3575a00f25
1 changed files with 66 additions and 15 deletions
|
|
@ -101,22 +101,31 @@ fn try_main() -> Result<(), DynError> {
|
|||
let task = env::args().nth(1);
|
||||
match task.as_deref() {
|
||||
Some("renode-image") => renode_image(false, &hw_pkgs)?,
|
||||
Some("renode-test") => renode_image(
|
||||
false,
|
||||
&cbtest_pkgs,
|
||||
)?,
|
||||
Some("renode-test") => renode_image(false, &cbtest_pkgs)?,
|
||||
Some("renode-image-debug") => renode_image(true, &hw_pkgs)?,
|
||||
Some("run") => run(false, &hw_pkgs)?,
|
||||
Some("hw-image") => build_hw_image(false, env::args().nth(2), &hw_pkgs, None)?,
|
||||
Some("benchmark") => build_hw_image(false, env::args().nth(2), &benchmark_pkgs, None)?,
|
||||
Some("minimal") => build_hw_image(false, env::args().nth(2), &minimal_pkgs, None)?,
|
||||
Some("cbtest") => build_hw_image(false, env::args().nth(2), &cbtest_pkgs, None)?,
|
||||
Some("trng-test") => build_hw_image(false, env::args().nth(2), &hw_pkgs,
|
||||
Some(&["--features", "ringosctest", "--features", "avalanchetest"]))?,
|
||||
Some("ro-test") => build_hw_image(false, env::args().nth(2), &hw_pkgs,
|
||||
Some(&["--features", "ringosctest"]))?,
|
||||
Some("av-test") => build_hw_image(false, env::args().nth(2), &hw_pkgs,
|
||||
Some(&["--features", "avalanchetest"]))?,
|
||||
Some("trng-test") => build_hw_image(
|
||||
false,
|
||||
env::args().nth(2),
|
||||
&hw_pkgs,
|
||||
Some(&["--features", "ringosctest", "--features", "avalanchetest"]),
|
||||
)?,
|
||||
Some("ro-test") => build_hw_image(
|
||||
false,
|
||||
env::args().nth(2),
|
||||
&hw_pkgs,
|
||||
Some(&["--features", "ringosctest"]),
|
||||
)?,
|
||||
Some("av-test") => build_hw_image(
|
||||
false,
|
||||
env::args().nth(2),
|
||||
&hw_pkgs,
|
||||
Some(&["--features", "avalanchetest"]),
|
||||
)?,
|
||||
Some("sr-test") => build_hw_image(false, env::args().nth(2), &sr_pkgs, None)?,
|
||||
Some("debug") => run(true, &hw_pkgs)?,
|
||||
_ => print_help(),
|
||||
|
|
@ -144,7 +153,12 @@ sr-test [soc.svd] builds the suspend/resume testing image
|
|||
)
|
||||
}
|
||||
|
||||
fn build_hw_image(debug: bool, svd: Option<String>, packages: &[&str], extra_args: Option<&[&str]>) -> Result<(), DynError> {
|
||||
fn build_hw_image(
|
||||
debug: bool,
|
||||
svd: Option<String>,
|
||||
packages: &[&str],
|
||||
extra_args: Option<&[&str]>,
|
||||
) -> Result<(), DynError> {
|
||||
let svd_file = match svd {
|
||||
Some(s) => s,
|
||||
None => return Err("svd file not specified".into()),
|
||||
|
|
@ -168,7 +182,13 @@ fn build_hw_image(debug: bool, svd: Option<String>, packages: &[&str], extra_arg
|
|||
pkg_path.push(pkg);
|
||||
init.push(pkg_path);
|
||||
}
|
||||
let mut loader = build(&["loader"], debug, Some(TARGET), Some("loader".into()), None)?;
|
||||
let mut loader = build(
|
||||
&["loader"],
|
||||
debug,
|
||||
Some(TARGET),
|
||||
Some("loader".into()),
|
||||
None,
|
||||
)?;
|
||||
loader.push(PathBuf::from("loader"));
|
||||
|
||||
let output_bundle = create_image(&kernel, &init, debug, MemorySpec::SvdFile(svd_file))?;
|
||||
|
|
@ -191,7 +211,8 @@ fn build_hw_image(debug: bool, svd: Option<String>, packages: &[&str], extra_arg
|
|||
"--",
|
||||
loader.as_os_str().to_str().unwrap(),
|
||||
loader_bin.as_os_str().to_str().unwrap(),
|
||||
]).status()?;
|
||||
])
|
||||
.status()?;
|
||||
if !status.success() {
|
||||
return Err("cargo build failed".into());
|
||||
}
|
||||
|
|
@ -225,7 +246,13 @@ fn renode_image(debug: bool, packages: &[&str]) -> Result<(), DynError> {
|
|||
pkg_path.push(pkg);
|
||||
init.push(pkg_path);
|
||||
}
|
||||
build(&["loader"], debug, Some(TARGET), Some("loader".into()), None)?;
|
||||
build(
|
||||
&["loader"],
|
||||
debug,
|
||||
Some(TARGET),
|
||||
Some("loader".into()),
|
||||
None,
|
||||
)?;
|
||||
|
||||
create_image(
|
||||
&kernel,
|
||||
|
|
@ -234,6 +261,24 @@ fn renode_image(debug: bool, packages: &[&str]) -> Result<(), DynError> {
|
|||
MemorySpec::SvdFile("emulation/soc/renode.svd".into()),
|
||||
)?;
|
||||
|
||||
// Regenerate the Platform file
|
||||
let status = Command::new(cargo())
|
||||
.current_dir(project_root())
|
||||
.args(&[
|
||||
"run",
|
||||
"-p",
|
||||
"svd2repl",
|
||||
"--",
|
||||
"-i",
|
||||
"emulation/soc/renode.svd",
|
||||
"-o",
|
||||
"emulation/soc/betrusted-soc.repl",
|
||||
])
|
||||
.status()?;
|
||||
if !status.success() {
|
||||
Err("Unable to regenerate Renode platform file")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +326,13 @@ fn run(debug: bool, init: &[&str]) -> Result<(), DynError> {
|
|||
}
|
||||
|
||||
fn build_kernel(debug: bool) -> Result<PathBuf, DynError> {
|
||||
let mut path = build(&["kernel"], debug, Some(TARGET), Some("kernel".into()), None)?;
|
||||
let mut path = build(
|
||||
&["kernel"],
|
||||
debug,
|
||||
Some(TARGET),
|
||||
Some("kernel".into()),
|
||||
None,
|
||||
)?;
|
||||
path.push("kernel");
|
||||
Ok(path)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue