mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
strip out debug shell commands from the kernel in bao1x targets
debug shell is actually not reachable in bao1x targets because the DUART is Tx-only. thus this code is just dead weight in the kernel for bao1x platforms.
This commit is contained in:
parent
d623dc723e
commit
c7d8b88456
2 changed files with 12 additions and 20 deletions
|
|
@ -7,10 +7,9 @@
|
||||||
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
use crate::{
|
use crate::io::SerialWrite;
|
||||||
args::KernelArguments,
|
#[cfg(not(feature = "bao1x"))]
|
||||||
io::{SerialRead, SerialWrite},
|
use crate::{args::KernelArguments, io::SerialRead};
|
||||||
};
|
|
||||||
|
|
||||||
/// Instance of the shell output.
|
/// Instance of the shell output.
|
||||||
pub static mut OUTPUT: Option<Output> = None;
|
pub static mut OUTPUT: Option<Output> = None;
|
||||||
|
|
@ -59,6 +58,7 @@ impl fmt::Write for Output {
|
||||||
/// Initialize the kernel shell.
|
/// Initialize the kernel shell.
|
||||||
///
|
///
|
||||||
/// This should be called in platform initialization code.
|
/// This should be called in platform initialization code.
|
||||||
|
#[cfg(not(feature = "bao1x"))]
|
||||||
pub fn init(serial: &'static mut dyn SerialWrite) {
|
pub fn init(serial: &'static mut dyn SerialWrite) {
|
||||||
unsafe { OUTPUT = Some(Output::new(serial)) }
|
unsafe { OUTPUT = Some(Output::new(serial)) }
|
||||||
|
|
||||||
|
|
@ -78,6 +78,7 @@ pub fn init(serial: &'static mut dyn SerialWrite) {
|
||||||
///
|
///
|
||||||
/// This should be called when a serial interface has new data, for example,
|
/// This should be called when a serial interface has new data, for example,
|
||||||
/// on an interrupt.
|
/// on an interrupt.
|
||||||
|
#[cfg(not(feature = "bao1x"))]
|
||||||
pub fn process_characters<R: SerialRead>(serial: &mut R) {
|
pub fn process_characters<R: SerialRead>(serial: &mut R) {
|
||||||
while let Some(b) = serial.getc() {
|
while let Some(b) = serial.getc() {
|
||||||
println!("> {}", b as char);
|
println!("> {}", b as char);
|
||||||
|
|
@ -85,6 +86,7 @@ pub fn process_characters<R: SerialRead>(serial: &mut R) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "bao1x"))]
|
||||||
fn handle_character(b: u8) {
|
fn handle_character(b: u8) {
|
||||||
use crate::services::ArchProcess;
|
use crate::services::ArchProcess;
|
||||||
|
|
||||||
|
|
@ -222,6 +224,7 @@ fn handle_character(b: u8) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "bao1x"))]
|
||||||
fn print_help() {
|
fn print_help() {
|
||||||
println!("Xous Kernel Debug");
|
println!("Xous Kernel Debug");
|
||||||
println!("key | command");
|
println!("key | command");
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,7 @@ use utralib::generated::*;
|
||||||
use xous_kernel::{MemoryFlags, MemoryType};
|
use xous_kernel::{MemoryFlags, MemoryType};
|
||||||
|
|
||||||
#[cfg(feature = "bao1x")]
|
#[cfg(feature = "bao1x")]
|
||||||
use crate::{
|
use crate::{PID, io::SerialWrite, mem::MemoryManager};
|
||||||
PID,
|
|
||||||
debug::shell::process_characters,
|
|
||||||
io::{SerialRead, SerialWrite},
|
|
||||||
mem::MemoryManager,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// UART virtual address.
|
/// UART virtual address.
|
||||||
///
|
///
|
||||||
|
|
@ -48,11 +43,12 @@ pub fn init() {
|
||||||
)
|
)
|
||||||
.expect("unable to map serial port")
|
.expect("unable to map serial port")
|
||||||
});
|
});
|
||||||
let mut uart = Uart::new(UART_ADDR, IRQ0_ADDR, process_characters);
|
let mut uart = Uart::new(UART_ADDR, IRQ0_ADDR);
|
||||||
uart.init();
|
uart.init();
|
||||||
unsafe {
|
unsafe {
|
||||||
UART = Some(uart);
|
UART = Some(uart);
|
||||||
crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap());
|
// inaccessible because DUART is tx-only
|
||||||
|
// crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,9 +59,7 @@ pub struct Uart {
|
||||||
|
|
||||||
#[cfg(feature = "bao1x")]
|
#[cfg(feature = "bao1x")]
|
||||||
impl Uart {
|
impl Uart {
|
||||||
pub fn new(addr: usize, _irq_addr: usize, _callback: fn(&mut Self)) -> Uart {
|
pub fn new(addr: usize, _irq_addr: usize) -> Uart { Uart { uart_csr: CSR::new(addr as *mut u32) } }
|
||||||
Uart { uart_csr: CSR::new(addr as *mut u32) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init(&mut self) {
|
pub fn init(&mut self) {
|
||||||
// duart requires no special initializations
|
// duart requires no special initializations
|
||||||
|
|
@ -79,8 +73,3 @@ impl SerialWrite for Uart {
|
||||||
self.uart_csr.wo(utra::duart::SFR_TXD, c as u32);
|
self.uart_csr.wo(utra::duart::SFR_TXD, c as u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "bao1x")]
|
|
||||||
impl SerialRead for Uart {
|
|
||||||
fn getc(&mut self) -> Option<u8> { None }
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue