From 7940529d0badd0c70e2aae080e16f86cbcca88d0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 14 Jan 2026 03:16:32 +0800 Subject: [PATCH] integrate gdb initializations into the kernel --- kernel/src/platform/bao1x/mod.rs | 4 ++++ kernel/src/platform/bao1x/uart.rs | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel/src/platform/bao1x/mod.rs b/kernel/src/platform/bao1x/mod.rs index c3917e16c..830f2cfe9 100644 --- a/kernel/src/platform/bao1x/mod.rs +++ b/kernel/src/platform/bao1x/mod.rs @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2022 Foundation Devices, Inc. // SPDX-FileCopyrightText: 2024 bunnie // SPDX-License-Identifier: Apache-2.0 +#[cfg(feature = "gdb-stub")] +pub mod gdbuart; #[cfg(all(feature = "bao1x", not(feature = "verilator-only")))] #[path = "rand.rs"] @@ -65,6 +67,8 @@ pub fn init() { self::rand::init(); #[cfg(any(feature = "debug-print", feature = "print-panics"))] self::uart::init(); + #[cfg(feature = "gdb-stub")] + crate::debug::gdb::init(); } #[derive(Debug, Copy, Clone, PartialEq, Eq)] diff --git a/kernel/src/platform/bao1x/uart.rs b/kernel/src/platform/bao1x/uart.rs index acebf21e6..032c27036 100644 --- a/kernel/src/platform/bao1x/uart.rs +++ b/kernel/src/platform/bao1x/uart.rs @@ -19,8 +19,6 @@ use crate::{PID, io::SerialWrite, mem::MemoryManager}; /// See https://github.com/betrusted-io/xous-core/blob/master/docs/memory.md #[cfg(feature = "bao1x")] pub const UART_ADDR: usize = 0xffcf_0000; -#[cfg(feature = "bao1x")] -pub const IRQ0_ADDR: usize = UART_ADDR + 0x1000; /// UART instance. /// @@ -43,12 +41,11 @@ pub fn init() { ) .expect("unable to map serial port") }); - let mut uart = Uart::new(UART_ADDR, IRQ0_ADDR); + let mut uart = Uart::new(UART_ADDR); uart.init(); unsafe { UART = Some(uart); - // inaccessible because DUART is tx-only - // crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap()); + crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap()); } } @@ -59,7 +56,7 @@ pub struct Uart { #[cfg(feature = "bao1x")] impl Uart { - pub fn new(addr: usize, _irq_addr: usize) -> Uart { Uart { uart_csr: CSR::new(addr as *mut u32) } } + pub fn new(addr: usize) -> Uart { Uart { uart_csr: CSR::new(addr as *mut u32) } } pub fn init(&mut self) { // duart requires no special initializations