cleanup warnings in gdb debug and cleanup debug shell for bao1x

bao1x debug shell has no input, so removing the help functions
will save space in the kernel
This commit is contained in:
bunnie 2026-01-14 03:15:26 +08:00
parent d380ea1ab6
commit d39087b2e9
4 changed files with 20 additions and 11 deletions

View file

@ -5,6 +5,9 @@ use gdbstub::stub::{GdbStubBuilder, GdbStubError, MultiThreadStopReason};
use gdbstub::target::Target;
use crate::io::SerialRead;
#[cfg(feature = "bao1x")]
use crate::platform::bao1x::gdbuart::GdbUart;
#[cfg(not(feature = "bao1x"))]
use crate::platform::precursor::gdbuart::GdbUart;
mod breakpoints;
@ -29,6 +32,9 @@ pub struct XousTarget {
pub struct XousDebugState<'a> {
pub target: XousTarget,
#[cfg(feature = "bao1x")]
pub server: GdbStubStateMachine<'a, XousTarget, crate::platform::bao1x::gdbuart::GdbUart>,
#[cfg(not(feature = "bao1x"))]
pub server: GdbStubStateMachine<'a, XousTarget, crate::platform::precursor::gdbuart::GdbUart>,
}

View file

@ -75,8 +75,8 @@ impl MultiThreadBase for XousTarget {
_tid: Tid, // same address space for each core
) -> TargetResult<(), Self> {
let current_addr = start_addr as usize;
if (current_addr + data.len()) >= crate::arch::mem::USER_AREA_END
|| (current_addr >= crate::arch::mem::USER_AREA_END)
if (current_addr + data.len()) >= xous_kernel::arch::USER_AREA_END
|| (current_addr >= xous_kernel::arch::USER_AREA_END)
{
for entry in data.iter_mut() {
*entry = 0
@ -143,7 +143,7 @@ impl MultiThreadBase for XousTarget {
return Ok(());
};
if (current_addr + data.len()) > crate::arch::mem::USER_AREA_END {
if (current_addr + data.len()) > xous_kernel::arch::USER_AREA_END {
return Ok(()); // don't allow reads outside of the user area
}

View file

@ -11,9 +11,9 @@ impl Target for XousTarget {
type Arch = gdbstub_arch::riscv::Riscv32;
type Error = &'static str;
fn base_ops(&mut self) -> BaseOps<Self::Arch, Self::Error> { BaseOps::MultiThread(self) }
fn base_ops(&mut self) -> BaseOps<'_, Self::Arch, Self::Error> { BaseOps::MultiThread(self) }
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<Self>> { Some(self) }
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<'_, Self>> { Some(self) }
/// Opt in to having GDB handle breakpoints for us. This allows for an unlimited number
/// of breakpoints without having us keep track of the breakpoints ourselves, but

View file

@ -7,9 +7,10 @@
use core::fmt;
use crate::io::SerialWrite;
use crate::args::KernelArguments;
#[cfg(not(feature = "bao1x"))]
use crate::{args::KernelArguments, io::SerialRead};
use crate::io::SerialRead;
use crate::io::SerialWrite;
/// Instance of the shell output.
pub static mut OUTPUT: Option<Output> = None;
@ -58,7 +59,6 @@ impl fmt::Write for Output {
/// Initialize the kernel shell.
///
/// This should be called in platform initialization code.
#[cfg(not(feature = "bao1x"))]
pub fn init(serial: &'static mut dyn SerialWrite) {
unsafe { OUTPUT = Some(Output::new(serial)) }
@ -69,9 +69,12 @@ pub fn init(serial: &'static mut dyn SerialWrite) {
println!(" {}", arg);
}
println!("=== Kernel Debug Shell Available ====");
print_help();
println!("=====================================");
#[cfg(not(feature = "bao1x"))]
{
println!("=== Kernel Debug Shell Available ====");
print_help();
println!("=====================================");
}
}
/// Process possible characters received through a serial interface.