integrate gdb initializations into the kernel

This commit is contained in:
bunnie 2026-01-14 03:16:32 +08:00
parent d39087b2e9
commit 7940529d0b
2 changed files with 7 additions and 6 deletions

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2022 Foundation Devices, Inc. <hello@foundationdevices.com>
// SPDX-FileCopyrightText: 2024 bunnie <bunnie@kosagi.com>
// 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)]

View file

@ -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