From c5ca371e084d2a875b49cc76037a80771ce506d7 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 12 Apr 2021 17:15:52 +0800 Subject: [PATCH] loader: fix debug warnings These warnings appeared as part of a change in Rust 1.50. Signed-off-by: Sean Cross --- loader/src/debug.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/loader/src/debug.rs b/loader/src/debug.rs index 2e7c12adb..4831402f8 100644 --- a/loader/src/debug.rs +++ b/loader/src/debug.rs @@ -1,11 +1,12 @@ use utralib::generated::*; pub struct Uart { - pub base: *mut u32, + // pub base: *mut u32, } impl Uart { pub fn putc(&self, c: u8) { - let mut uart = CSR::new(self.base); + let base = utra::uart::HW_UART_BASE as *mut u32; + let mut uart = CSR::new(base); // Wait until TXFULL is `0` while uart.r(utra::uart::TXFULL) != 0 {} uart.wo(utra::uart::RXTX, c as u32) @@ -25,17 +26,12 @@ impl Write for Uart { #[macro_use] #[cfg(all(not(test), feature = "debug-print"))] pub mod debug_print_hardware { - use crate::debug::*; - pub const SUPERVISOR_UART: Uart = Uart { - base: utra::uart::HW_UART_BASE as *mut u32, - }; - #[macro_export] macro_rules! print { ($($args:tt)+) => ({ use core::fmt::Write; - let _ = write!(crate::debug::debug_print_hardware::SUPERVISOR_UART, $($args)+); + let _ = write!(crate::debug::Uart {}, $($args)+); }); } }