diff --git a/loader/Cargo.toml b/loader/Cargo.toml index 427f0f812..18a98ccdd 100644 --- a/loader/Cargo.toml +++ b/loader/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "Initial kernel loader for Xous" [dependencies] -utralib = {path = "../utralib"} +utralib = {path = "utralib"} [dependencies.com_rs] git="https://github.com/betrusted-io/com_rs" @@ -42,7 +42,7 @@ debug = true # symbols are nice and they don't increase the size on Flash lto = "fat" [target.'cfg(not(any(windows, unix)))'.dependencies] -utralib = { path = "../utralib"} +utralib = { path = "utralib"} # patch key references into our local name space [patch.crates-io.sha2] @@ -51,7 +51,7 @@ package = "sha2" default-features = false [patch.crates-io.utralib] -path = "../utralib" +path = "utralib" [patch.crates-io.curve25519-dalek] git="https://github.com/betrusted-io/curve25519-dalek.git" diff --git a/loader/sha2/Cargo.toml b/loader/sha2/Cargo.toml index fa32b50d4..7569e439a 100644 --- a/loader/sha2/Cargo.toml +++ b/loader/sha2/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "sha2 hardware accelerator engine" [dependencies] -utralib = {path = "../../utralib"} +utralib = {path = "../utralib"} # Rust-standard digest API dependencies digest = "0.9" @@ -14,7 +14,7 @@ block-buffer = "0.9" opaque-debug = "0.3" # prevents internal hash state leakage from debug structures [target.'cfg(not(any(windows,unix)))'.dependencies] -utralib = { path = "../../utralib"} +utralib = { path = "../utralib"} [features] default = [] diff --git a/loader/utralib/.gitignore b/loader/utralib/.gitignore new file mode 100644 index 000000000..015ca2444 --- /dev/null +++ b/loader/utralib/.gitignore @@ -0,0 +1,2 @@ +target/ +src/generated.rs diff --git a/loader/utralib/Cargo.lock b/loader/utralib/Cargo.lock new file mode 100644 index 000000000..26701f447 --- /dev/null +++ b/loader/utralib/Cargo.lock @@ -0,0 +1,143 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "hermit-abi" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "quick-xml" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d72d5477478f85bd00b6521780dfba1ec6cdaadcf90b8b181c36d7de561f9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "svd2utra" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "quick-xml", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "utralib" +version = "0.1.0" +dependencies = [ + "svd2utra", +] + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/loader/utralib/Cargo.toml b/loader/utralib/Cargo.toml new file mode 100644 index 000000000..5366f1113 --- /dev/null +++ b/loader/utralib/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "utralib" +version = "0.1.0" +authors = ["Sean Cross "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[build-dependencies] +svd2utra = { path = "../../svd2utra" } diff --git a/loader/utralib/README.md b/loader/utralib/README.md new file mode 100644 index 000000000..60461647f --- /dev/null +++ b/loader/utralib/README.md @@ -0,0 +1,4 @@ +# UTRA + +The meat of this directory is auto-generated by svd2utra. Documentation +on this API is also located in that directory. diff --git a/loader/utralib/build.rs b/loader/utralib/build.rs new file mode 100644 index 000000000..50cf18224 --- /dev/null +++ b/loader/utralib/build.rs @@ -0,0 +1,14 @@ +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"); + + let svd_file_path = std::path::Path::new(&svd_filename); + println!("cargo:rerun-if-changed={}", svd_file_path.canonicalize().unwrap().display()); + + let src_file = std::fs::File::open(svd_filename).expect("couldn't open src file"); + let mut dest_file = std::fs::File::create("src/generated.rs").expect("couldn't open dest file"); + svd2utra::generate(src_file, &mut dest_file).unwrap(); +} diff --git a/loader/utralib/src/lib.rs b/loader/utralib/src/lib.rs new file mode 100644 index 000000000..6cf78339f --- /dev/null +++ b/loader/utralib/src/lib.rs @@ -0,0 +1,3 @@ +#![cfg_attr(target_os = "none", no_std)] +pub mod generated; +pub use generated::*;