mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
kernel: use target_os = "none" instead of baremetal
This is more portable, and plays nicer with `rust-analyzer`. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
df30fd580d
commit
2cd42edc22
2 changed files with 19 additions and 19 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
use core::fmt::{Error, Write};
|
use core::fmt::{Error, Write};
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
use utralib::generated::*;
|
use utralib::generated::*;
|
||||||
|
|
||||||
pub static mut DEBUG_OUTPUT: Option<&'static mut dyn Write> = None;
|
pub static mut DEBUG_OUTPUT: Option<&'static mut dyn Write> = None;
|
||||||
|
|
@ -10,7 +10,7 @@ pub static mut DEBUG_OUTPUT: Option<&'static mut dyn Write> = None;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(test),
|
not(test),
|
||||||
baremetal,
|
target_os = "none",
|
||||||
any(feature = "debug-print", feature = "print-panics")
|
any(feature = "debug-print", feature = "print-panics")
|
||||||
))]
|
))]
|
||||||
pub mod debug_print_hardware {
|
pub mod debug_print_hardware {
|
||||||
|
|
@ -19,12 +19,12 @@ pub mod debug_print_hardware {
|
||||||
}
|
}
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(test),
|
not(test),
|
||||||
baremetal,
|
target_os = "none",
|
||||||
any(feature = "debug-print", feature = "print-panics")
|
any(feature = "debug-print", feature = "print-panics")
|
||||||
))]
|
))]
|
||||||
pub use crate::debug::debug_print_hardware::SUPERVISOR_UART_ADDR;
|
pub use crate::debug::debug_print_hardware::SUPERVISOR_UART_ADDR;
|
||||||
|
|
||||||
#[cfg(all(not(test), baremetal))]
|
#[cfg(all(target_os = "none"))]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($args:tt)+) => {{
|
($($args:tt)+) => {{
|
||||||
|
|
@ -36,7 +36,7 @@ macro_rules! print {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! println
|
macro_rules! println
|
||||||
{
|
{
|
||||||
|
|
@ -51,15 +51,15 @@ macro_rules! println
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
pub struct Uart {}
|
pub struct Uart {}
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
pub static mut UART: Uart = Uart {};
|
pub static mut UART: Uart = Uart {};
|
||||||
|
|
||||||
#[cfg(all(baremetal, feature = "wrap-print"))]
|
#[cfg(all(target_os = "none", feature = "wrap-print"))]
|
||||||
static mut CHAR_COUNT: usize = 0;
|
static mut CHAR_COUNT: usize = 0;
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
impl Uart {
|
impl Uart {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn init(self) {
|
pub fn init(self) {
|
||||||
|
|
@ -120,10 +120,10 @@ impl Uart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", target_os = "none"))]
|
||||||
mod gdb_server;
|
mod gdb_server;
|
||||||
|
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", target_os = "none"))]
|
||||||
impl gdbstub::Connection for Uart {
|
impl gdbstub::Connection for Uart {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
|
|
@ -149,7 +149,7 @@ impl gdbstub::Connection for Uart {
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(test),
|
not(test),
|
||||||
baremetal,
|
target_os = "none",
|
||||||
any(feature = "debug-print", feature = "print-panics")
|
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) {
|
||||||
|
|
@ -161,7 +161,7 @@ pub fn irq(_irq_number: usize, _arg: *mut usize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_irq_character(b: u8) {
|
fn process_irq_character(b: u8) {
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", target_os = "none"))]
|
||||||
if gdb_server::handle(b) {
|
if gdb_server::handle(b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +257,7 @@ fn process_irq_character(b: u8) {
|
||||||
});
|
});
|
||||||
println!("{} k total", total_bytes / 1024);
|
println!("{} k total", total_bytes / 1024);
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", target_os = "none"))]
|
||||||
b'g' => {
|
b'g' => {
|
||||||
println!("Starting GDB server -- attach your debugger now");
|
println!("Starting GDB server -- attach your debugger now");
|
||||||
gdb_server::setup();
|
gdb_server::setup();
|
||||||
|
|
@ -266,7 +266,7 @@ fn process_irq_character(b: u8) {
|
||||||
println!("Xous Kernel Debug");
|
println!("Xous Kernel Debug");
|
||||||
println!("key | command");
|
println!("key | command");
|
||||||
println!("--- + -----------------------");
|
println!("--- + -----------------------");
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", target_os = "none"))]
|
||||||
println!(" g | enter the gdb server");
|
println!(" g | enter the gdb server");
|
||||||
println!(" m | print MMU page tables of all processes");
|
println!(" m | print MMU page tables of all processes");
|
||||||
println!(" p | print all processes");
|
println!(" p | print all processes");
|
||||||
|
|
@ -277,7 +277,7 @@ fn process_irq_character(b: u8) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
impl Write for Uart {
|
impl Write for Uart {
|
||||||
fn write_str(&mut self, s: &str) -> Result<(), Error> {
|
fn write_str(&mut self, s: &str) -> Result<(), Error> {
|
||||||
for c in s.bytes() {
|
for c in s.bytes() {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#![cfg_attr(baremetal, no_main)]
|
#![cfg_attr(baremetal, no_main)]
|
||||||
#![cfg_attr(baremetal, no_std)]
|
#![cfg_attr(baremetal, no_std)]
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
|
|
||||||
|
|
@ -28,9 +28,9 @@ mod syscall;
|
||||||
use services::SystemServices;
|
use services::SystemServices;
|
||||||
use xous_kernel::*;
|
use xous_kernel::*;
|
||||||
|
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
#[cfg(baremetal)]
|
#[cfg(target_os = "none")]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn handle_panic(_arg: &PanicInfo) -> ! {
|
fn handle_panic(_arg: &PanicInfo) -> ! {
|
||||||
println!("PANIC in PID {}: {}", crate::arch::current_pid(), _arg);
|
println!("PANIC in PID {}: {}", crate::arch::current_pid(), _arg);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue