From 9ee43a7acc3e205843a981c881eed3e18e7ee09e Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 15 Oct 2020 00:01:02 +0800 Subject: [PATCH] some more attempts to get log strings working... --- services/shell/src/logstr.rs | 7 +++++++ services/shell/src/main.rs | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/services/shell/src/logstr.rs b/services/shell/src/logstr.rs index c0927f620..cc8e613f0 100644 --- a/services/shell/src/logstr.rs +++ b/services/shell/src/logstr.rs @@ -40,6 +40,13 @@ impl<'a> LogStr<'a> { } pub fn as_memory_message(&self, id: xous::MessageId) -> Result { + + print!("SHELL: String @ {:08x}:", self.raw_slice.as_ptr() as usize); + for offset in 0..self.len { + print!(" {:02x}", self.raw_slice[offset]); + } + println!(" (length: {})", self.len); + Ok(xous::MemoryMessage { id, buf: xous::MemoryRange::new(self.raw_slice.as_ptr() as usize, self.raw_slice.len()).unwrap(), diff --git a/services/shell/src/main.rs b/services/shell/src/main.rs index 7f0301da0..9bb4d7544 100644 --- a/services/shell/src/main.rs +++ b/services/shell/src/main.rs @@ -79,7 +79,7 @@ fn shell_main() -> ! { ) .expect("couldn't map GPIO CSR range"); let mut gpio = CSR::new(gpio_base.as_mut_ptr() as *mut u32); - gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 1); + gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 2); let mut last_time: u64 = 0; loop { @@ -92,16 +92,19 @@ fn shell_main() -> ! { xous::try_send_message(log_conn, xous::Message::Scalar(xous::ScalarMessage{id:256, arg1: elapsed_time as usize, arg2: 257, arg3: 258, arg4: 259})); */ + println!("Preparing a mutable borrow message"); + ls.clear(); write!(ls, "Hello, Server! This memory is borrowed from another process. Elapsed: {}", elapsed_time as usize).expect("couldn't send hello message"); + let mm = ls.as_memory_message(0) + .expect("couldn't form memory message"); + println!("Sending a mutable borrow message"); + let response = xous::syscall::try_send_message( log_conn, - xous::Message::MutableBorrow( - ls.as_memory_message(0) - .expect("couldn't form memory message"), - ), + xous::Message::MutableBorrow(mm), ) .expect("couldn't send memory message"); //unsafe { ls.set_len(response.0)};