xous-log: fix precursor build

This commit is contained in:
eupn 2023-03-29 22:44:19 +04:00
parent b059170e8d
commit c27bc6e088
No known key found for this signature in database
GPG key ID: 6A550BE33BE768A9
5 changed files with 9 additions and 7 deletions

View file

@ -51,7 +51,7 @@ fn handle_scalar(
1200 => writeln!(output, "Terminating process").unwrap(), 1200 => writeln!(output, "Terminating process").unwrap(),
2000 => { 2000 => {
#[cfg(any(feature="precursor", feature="renode"))] #[cfg(any(feature="precursor", feature="renode"))]
crate::debug::DEFAULT.enable_rx(); crate::platform::debug::DEFAULT.enable_rx();
writeln!(output, "Resuming logger").unwrap(); writeln!(output, "Resuming logger").unwrap();
} }
_ => writeln!( _ => writeln!(

View file

@ -5,6 +5,9 @@ pub mod precursor;
#[cfg(any(feature="precursor", feature="renode"))] #[cfg(any(feature="precursor", feature="renode"))]
pub use precursor::debug; pub use precursor::debug;
#[cfg(any(feature="precursor", feature="renode"))]
pub use precursor::implementation;
#[cfg(not(target_os = "xous"))] #[cfg(not(target_os = "xous"))]
#[macro_use] #[macro_use]
pub mod hosted; pub mod hosted;

View file

@ -7,7 +7,7 @@ macro_rules! print
{ {
($($args:tt)+) => ({ ($($args:tt)+) => ({
use core::fmt::Write; use core::fmt::Write;
let _ = write!(crate::debug::Uart {}, $($args)+); let _ = write!(crate::platform::debug::Uart {}, $($args)+);
}); });
} }
#[macro_export] #[macro_export]
@ -28,7 +28,7 @@ macro_rules! println
fn handle_irq(irq_no: usize, arg: *mut usize) { fn handle_irq(irq_no: usize, arg: *mut usize) {
print!("Handling IRQ {} (arg: {:08x}): ", irq_no, arg as usize); print!("Handling IRQ {} (arg: {:08x}): ", irq_no, arg as usize);
while let Some(c) = { crate::debug::Uart {} }.getc() { while let Some(c) = { crate::platform::debug::Uart {} }.getc() {
print!("{}", c as char); print!("{}", c as char);
} }
println!(); println!();

View file

@ -12,7 +12,7 @@ pub fn init() -> Output {
xous::MemoryFlags::R | xous::MemoryFlags::W, xous::MemoryFlags::R | xous::MemoryFlags::W,
) )
.expect("couldn't map serial port"); .expect("couldn't map serial port");
unsafe { crate::debug::DEFAULT_UART_ADDR = uart.as_mut_ptr() as _ }; unsafe { crate::platform::debug::DEFAULT_UART_ADDR = uart.as_mut_ptr() as _ };
println!("Mapped UART @ {:08x}", uart.as_ptr() as usize); println!("Mapped UART @ {:08x}", uart.as_ptr() as usize);
let mut uart_csr = CSR::new(uart.as_mut_ptr() as *mut u32); let mut uart_csr = CSR::new(uart.as_mut_ptr() as *mut u32);
@ -55,7 +55,7 @@ impl Output {
fn handle_console_irq(_irq_no: usize, arg: *mut usize) { fn handle_console_irq(_irq_no: usize, arg: *mut usize) {
if cfg!(feature = "logging") { if cfg!(feature = "logging") {
let mut inject_csr = CSR::new(arg as *mut u32); let mut inject_csr = CSR::new(arg as *mut u32);
let mut uart_csr = CSR::new(unsafe { crate::debug::DEFAULT_UART_ADDR as *mut u32 }); let mut uart_csr = CSR::new(unsafe { crate::platform::debug::DEFAULT_UART_ADDR as *mut u32 });
// println!("rxe {}", uart_csr.rf(utra::uart::RXEMPTY_RXEMPTY)); // println!("rxe {}", uart_csr.rf(utra::uart::RXEMPTY_RXEMPTY));
while uart_csr.rf(utra::uart::RXEMPTY_RXEMPTY) == 0 { while uart_csr.rf(utra::uart::RXEMPTY_RXEMPTY) == 0 {
// I really rather think this is more readable, than the "Rusty" version below. // I really rather think this is more readable, than the "Rusty" version below.
@ -93,7 +93,7 @@ pub struct OutputWriter {}
impl OutputWriter { impl OutputWriter {
pub fn putc(&self, c: u8) { pub fn putc(&self, c: u8) {
if cfg!(feature = "logging") { if cfg!(feature = "logging") {
let mut uart_csr = CSR::new(unsafe { crate::debug::DEFAULT_UART_ADDR as *mut u32 }); let mut uart_csr = CSR::new(unsafe { crate::platform::debug::DEFAULT_UART_ADDR as *mut u32 });
// Wait until TXFULL is `0` // Wait until TXFULL is `0`
while uart_csr.r(utra::uart::TXFULL) != 0 {} while uart_csr.r(utra::uart::TXFULL) != 0 {}

View file

@ -1,4 +1,3 @@
#[cfg(feature = "debugprint")]
#[macro_use] #[macro_use]
pub mod debug; pub mod debug;