mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
xtask: support building under riscv32imac-unknown-xous-elf
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
ff23ba7eb0
commit
987434433e
2 changed files with 11 additions and 18 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// this code vendored in from https://github.com/terry90/internationalization-rs
|
||||
// the original crate is targeted at a non-workspace, `std` project structure. The adaptations here
|
||||
// make it suitable for `no_std` and workspace integration.
|
||||
|
|
@ -29,7 +28,7 @@ fn read_locales() -> Translations {
|
|||
|
||||
for entry in glob(&locales).expect("Failed to read glob pattern") {
|
||||
let entry = entry.unwrap();
|
||||
println!("cargo:rerun-if-changed={}", entry.display());
|
||||
// println!("cargo:rerun-if-changed={}", entry.display());
|
||||
let file = File::open(entry).expect("Failed to open the file");
|
||||
let mut reader = std::io::BufReader::new(file);
|
||||
let mut content = String::new();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ use generate_locales::*;
|
|||
|
||||
type DynError = Box<dyn std::error::Error>;
|
||||
|
||||
const TARGET: &str = "riscv32imac-unknown-none-elf";
|
||||
const PROGRAM_TARGET: &str = "riscv32imac-unknown-none-elf";
|
||||
const KERNEL_TARGET: &str = "riscv32imac-unknown-none-elf";
|
||||
|
||||
enum MemorySpec {
|
||||
SvdFile(String),
|
||||
|
|
@ -31,14 +32,7 @@ impl std::fmt::Display for BuildError {
|
|||
|
||||
impl std::error::Error for BuildError {}
|
||||
|
||||
fn main() {
|
||||
if let Err(e) = try_main() {
|
||||
eprintln!("{}", e);
|
||||
std::process::exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
fn try_main() -> Result<(), DynError> {
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let hw_pkgs = [
|
||||
"gam",
|
||||
"status",
|
||||
|
|
@ -287,7 +281,7 @@ fn build_hw_image(
|
|||
|
||||
let kernel = build_kernel(debug)?;
|
||||
let mut init = vec![];
|
||||
let base_path = build(packages, debug, Some(TARGET), None, extra_args)?;
|
||||
let base_path = build(packages, debug, Some(PROGRAM_TARGET), None, extra_args)?;
|
||||
for pkg in packages {
|
||||
let mut pkg_path = base_path.clone();
|
||||
pkg_path.push(pkg);
|
||||
|
|
@ -296,7 +290,7 @@ fn build_hw_image(
|
|||
let mut loader = build(
|
||||
&["loader"],
|
||||
debug,
|
||||
Some(TARGET),
|
||||
Some(KERNEL_TARGET),
|
||||
Some("loader".into()),
|
||||
None,
|
||||
)?;
|
||||
|
|
@ -390,8 +384,8 @@ fn build_hw_image(
|
|||
}
|
||||
|
||||
println!();
|
||||
println!("Signed loader at {}", loader_bin.to_str().unwrap());
|
||||
println!("Signed kernel at {}", xous_img_path.to_str().unwrap());
|
||||
println!("Signed loader at {}", loader_bin.display());
|
||||
println!("Signed kernel at {}", xous_img_path.display());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -484,7 +478,7 @@ fn build_kernel(debug: bool) -> Result<PathBuf, DynError> {
|
|||
let mut path = build(
|
||||
&["kernel"],
|
||||
debug,
|
||||
Some(TARGET),
|
||||
Some(KERNEL_TARGET),
|
||||
Some("kernel".into()),
|
||||
None,
|
||||
)?;
|
||||
|
|
@ -560,7 +554,7 @@ fn create_image(
|
|||
let stream = if debug { "debug" } else { "release" };
|
||||
let mut args = vec!["run", "--package", "tools", "--bin", "create-image", "--"];
|
||||
|
||||
let output_file = format!("target/{}/{}/args.bin", TARGET, stream);
|
||||
let output_file = format!("target/{}/{}/args.bin", PROGRAM_TARGET, stream);
|
||||
args.push(&output_file);
|
||||
|
||||
args.push("--kernel");
|
||||
|
|
@ -586,7 +580,7 @@ fn create_image(
|
|||
if !status.success() {
|
||||
return Err("cargo build failed".into());
|
||||
}
|
||||
Ok(project_root().join(&format!("target/{}/{}/args.bin", TARGET, stream)))
|
||||
Ok(project_root().join(&format!("target/{}/{}/args.bin", PROGRAM_TARGET, stream)))
|
||||
}
|
||||
|
||||
fn cargo() -> String {
|
||||
|
|
|
|||
Loading…
Reference in a new issue