make build BOARD=k210 sucessfully

This commit is contained in:
Yu Chen 2022-06-23 22:23:49 +08:00
parent 8e6f364ecc
commit e7d6406f45
8 changed files with 96 additions and 9 deletions

View file

@ -1,4 +1,8 @@
use crate::drivers::chardev::{CharDevice, UART};
use crate::drivers::chardev::CharDevice;
#[cfg(feature = "board_qemu")]
use crate::drivers::chardev::UART;
#[cfg(feature = "board_k210")]
use crate::sbi::console_putchar;
use core::fmt::{self, Write};
struct Stdout;
@ -6,7 +10,10 @@ struct Stdout;
impl Write for Stdout {
fn write_str(&mut self, s: &str) -> fmt::Result {
for c in s.chars() {
#[cfg(feature = "board_qemu")]
UART.write(c as u8);
#[cfg(feature = "board_k210")]
console_putchar(c as usize);
}
Ok(())
}