mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
kernel: print-panics: implement this feature in debug.rs
With this feature enabled, claim the kernel UART for panic printing. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
750f05c322
commit
b78a71c495
2 changed files with 5 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use core::fmt::{Error, Write};
|
use core::fmt::{Error, Write};
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
#[cfg(all(not(test), feature = "debug-print"))]
|
#[cfg(all(not(test), any(feature = "debug-print", feature = "print-panics")))]
|
||||||
pub mod debug_print_hardware {
|
pub mod debug_print_hardware {
|
||||||
use crate::debug::*;
|
use crate::debug::*;
|
||||||
pub const SUPERVISOR_UART: Uart = Uart {
|
pub const SUPERVISOR_UART: Uart = Uart {
|
||||||
|
|
@ -16,10 +16,10 @@ pub mod debug_print_hardware {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(all(not(test), feature = "debug-print"))]
|
#[cfg(all(not(test), any(feature = "debug-print", feature = "print-panics")))]
|
||||||
pub use crate::debug::debug_print_hardware::SUPERVISOR_UART;
|
pub use crate::debug::debug_print_hardware::SUPERVISOR_UART;
|
||||||
|
|
||||||
#[cfg(all(not(test), not(feature = "debug-print")))]
|
#[cfg(all(not(test), not(any(feature = "debug-print", feature = "print-panics"))))]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($args:tt)+) => {{
|
($($args:tt)+) => {{
|
||||||
|
|
@ -82,7 +82,7 @@ impl Uart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(test), feature = "debug-print"))]
|
#[cfg(all(not(test), any(feature = "debug-print", feature = "print-panics")))]
|
||||||
pub fn irq(_irq_number: usize, _arg: *mut usize) {
|
pub fn irq(_irq_number: usize, _arg: *mut usize) {
|
||||||
println!(
|
println!(
|
||||||
"Interrupt {}: Key pressed: {}",
|
"Interrupt {}: Key pressed: {}",
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ pub extern "C" fn init(arg_offset: *const u32, init_offset: *const u32, rpt_offs
|
||||||
|
|
||||||
// Either map memory using a syscall, or if we're debugging the syscall
|
// Either map memory using a syscall, or if we're debugging the syscall
|
||||||
// handler then directly map it.
|
// handler then directly map it.
|
||||||
#[cfg(feature = "debug-print")]
|
#[cfg(any(feature = "debug-print", feature = "print-panics"))]
|
||||||
{
|
{
|
||||||
// Map the serial port so println!() works as expected.
|
// Map the serial port so println!() works as expected.
|
||||||
mem::MemoryManager::with_mut(|memory_manager| {
|
mem::MemoryManager::with_mut(|memory_manager| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue