mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
xous-rs: remove log, hex, and debug-here deps
The `xous-rs` library is used in many places, and should have as few dependencies as possible. Remove these as dependencies. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
8edf03a243
commit
58dd02c282
6 changed files with 45 additions and 45 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -3843,10 +3843,7 @@ version = "0.9.7"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"compiler_builtins",
|
||||
"debug-here",
|
||||
"hex",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"rustc-std-workspace-core",
|
||||
"xous-macros",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ homepage = "https://betrusted.io/"
|
|||
[dependencies]
|
||||
bitflags = {version = "1.2.1", optional = true }
|
||||
xous-macros = { path = "../macros", version = "0.1.0", optional = true }
|
||||
log = { version = "0.4.14", optional = true }
|
||||
core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' }
|
||||
compiler_builtins = { version = '0.1.0', optional = true }
|
||||
|
||||
|
|
@ -25,10 +24,6 @@ forget-memory-messages = []
|
|||
# Enable using `bitflags`
|
||||
bit-flags = ["bitflags"]
|
||||
|
||||
# `logging` causes this program to connect to a log server on startup
|
||||
# so you can run log commands such as `info!()`.
|
||||
logging = ["log"]
|
||||
|
||||
# This is being built as part of libstd
|
||||
rustc-dep-of-std = ['core', 'compiler_builtins/rustc-dep-of-std']
|
||||
|
||||
|
|
@ -40,5 +35,3 @@ default = ["bit-flags", "xous-macros"]
|
|||
|
||||
[target.'cfg(any(windows,unix))'.dependencies]
|
||||
lazy_static = "1.4.0"
|
||||
hex = "0.4.3"
|
||||
debug-here = "0.2.2"
|
||||
|
|
|
|||
|
|
@ -39,11 +39,7 @@ lazy_static::lazy_static! {
|
|||
|
||||
// resume with PROCESS_KEY initialization
|
||||
std::env::var("XOUS_PROCESS_KEY")
|
||||
.map(|s| {
|
||||
let mut base = ProcessKey([0u8; 16]);
|
||||
hex::decode_to_slice(s, &mut base.0).unwrap();
|
||||
base
|
||||
})
|
||||
.map(|s| s.as_str().into())
|
||||
.unwrap_or(ProcessKey([0u8; 16]))
|
||||
};
|
||||
|
||||
|
|
@ -286,8 +282,7 @@ fn read_next_syscall_result(
|
|||
if data != previous_data.as_slice() {
|
||||
println!("Data: {:x?}", data);
|
||||
println!("Previous data: {:x?}", previous_data);
|
||||
::debug_here::debug_here!();
|
||||
panic!("Data was not equal!");
|
||||
panic!("Data changed during borrow!");
|
||||
}
|
||||
// assert_eq!(
|
||||
// data,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,26 @@ impl ProcessKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<String> for ProcessKey {
|
||||
fn into(self) -> String {
|
||||
let mut out = String::new();
|
||||
for i in self.0 {
|
||||
out.push_str(&format!("{:02x}", i));
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for ProcessKey {
|
||||
fn from(v: &str) -> ProcessKey {
|
||||
let mut key = [0u8; 16];
|
||||
for (src, dest) in v.as_bytes().chunks(2).zip(key.iter_mut()) {
|
||||
*dest = u8::from_str_radix(core::str::from_utf8(src).unwrap(), 16).unwrap();
|
||||
}
|
||||
ProcessKey::new(key)
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes all parameters that are required to start a new process
|
||||
/// on this platform.
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
|
@ -125,7 +145,7 @@ pub fn create_process_post(
|
|||
let server_env = format!("{}", CHILD_PROCESS_ADDRESS.lock().unwrap());
|
||||
let pid_env = format!("{}", startup.pid);
|
||||
let process_name_env = args.name.to_string();
|
||||
let process_key_env = hex::encode(&init.key.0);
|
||||
let process_key_env: String = init.key.into();
|
||||
let (shell, args) = if cfg!(windows) {
|
||||
("cmd", ["/C", &args.command])
|
||||
} else if cfg!(unix) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,26 @@ impl ProcessKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<String> for ProcessKey {
|
||||
fn into(self) -> String {
|
||||
let mut out = String::new();
|
||||
for i in self.0 {
|
||||
out.push_str(&format!("{:02x}", i));
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for ProcessKey {
|
||||
fn from(v: &str) -> ProcessKey {
|
||||
let mut key = [0u8; 16];
|
||||
for (src, dest) in v.as_bytes().chunks(2).zip(key.iter_mut()) {
|
||||
*dest = u8::from_str_radix(core::str::from_utf8(src).unwrap(), 16).unwrap();
|
||||
}
|
||||
ProcessKey::new(key)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ThreadInit {}
|
||||
|
||||
|
|
@ -226,7 +246,7 @@ pub fn create_process_post(
|
|||
let server_env = format!("{}", xous_address());
|
||||
let pid_env = format!("{}", startup.pid);
|
||||
let process_name_env = args.name.to_string();
|
||||
let process_key_env = hex::encode(&init.key.0);
|
||||
let process_key_env: String = init.key.into();
|
||||
let (shell, args) = if cfg!(windows) {
|
||||
("cmd", ["/C", &args.command])
|
||||
} else if cfg!(unix) {
|
||||
|
|
@ -343,11 +363,7 @@ fn default_xous_address() -> SocketAddr {
|
|||
|
||||
fn default_process_key() -> ProcessKey {
|
||||
std::env::var("XOUS_PROCESS_KEY")
|
||||
.map(|s| {
|
||||
let mut base = ProcessKey([0u8; 16]);
|
||||
hex::decode_to_slice(s, &mut base.0).unwrap();
|
||||
base
|
||||
})
|
||||
.map(|s| s.as_str().into())
|
||||
.unwrap_or(ProcessKey([0u8; 16]))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,29 +31,8 @@ pub use locale::LANG;
|
|||
#[cfg(feature = "processes-as-threads")]
|
||||
pub use crate::arch::ProcessArgsAsThread;
|
||||
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
pub fn init() {}
|
||||
|
||||
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||
pub fn init() {
|
||||
use std::panic;
|
||||
panic::set_hook(Box::new(|arg| {
|
||||
println!("PANIC!");
|
||||
println!("Details: {:?}", arg);
|
||||
debug_here::debug_here!();
|
||||
}));
|
||||
}
|
||||
|
||||
/// Convert a four-letter string into a 32-bit int.
|
||||
#[macro_export]
|
||||
macro_rules! make_name {
|
||||
($fcc:expr) => {{
|
||||
let mut c: [u8; 4] = Default::default();
|
||||
c.copy_from_slice($fcc.as_bytes());
|
||||
u32::from_le_bytes(c) as usize
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "none"))]
|
||||
#[macro_export]
|
||||
macro_rules! maybe_main {
|
||||
|
|
|
|||
Loading…
Reference in a new issue