Make println! raw and an info! having the timestamp.

pull/37/head
Andre Richter 5 years ago
parent 1cc034b364
commit 79a2a202b2
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

Binary file not shown.

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

Binary file not shown.

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

Binary file not shown.

@ -47,7 +47,7 @@ CONTAINER_UTILS = rustembedded/osdev-utils
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
.PHONY: all doc qemu clippy clean readelf objdump nm .PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

Binary file not shown.

@ -107,7 +107,7 @@ diff -uNr 06_drivers_gpio_uart/Makefile 07_uart_chainloader/Makefile
DOCKER_CMD = docker run -it --rm DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
-DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -kernel $(OUTPUT) -DOCKER_EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) $(QEMU_MISC_ARGS) -kernel
+DOCKER_ARG_TTY = --privileged -v /dev:/dev +DOCKER_ARG_TTY = --privileged -v /dev:/dev
-.PHONY: all doc qemu clippy clean readelf objdump nm -.PHONY: all doc qemu clippy clean readelf objdump nm

Binary file not shown.

Binary file not shown.

@ -387,15 +387,15 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
- for i in 0..size { - for i in 0..size {
- *kernel_addr.offset(i as isize) = bsp::console().read_char() as u8; - *kernel_addr.offset(i as isize) = bsp::console().read_char() as u8;
- } - }
+ println!("Booting on: {}", bsp::board_name()); + info!("Booting on: {}", bsp::board_name());
+ println!( + info!(
+ "Architectural timer resolution: {} ns", + "Architectural timer resolution: {} ns",
+ arch::timer().resolution().as_nanos() + arch::timer().resolution().as_nanos()
+ ); + );
+ +
+ println!("Drivers loaded:"); + info!("Drivers loaded:");
+ for (i, driver) in bsp::device_drivers().iter().enumerate() { + for (i, driver) in bsp::device_drivers().iter().enumerate() {
+ println!(" {}. {}", i + 1, driver.compatible()); + info!(" {}. {}", i + 1, driver.compatible());
} }
- println!("[ML] Loaded! Executing the payload now\n"); - println!("[ML] Loaded! Executing the payload now\n");
@ -409,7 +409,7 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
- // Jump to loaded kernel! - // Jump to loaded kernel!
- kernel() - kernel()
+ loop { + loop {
+ println!("Spinning for 1 second"); + info!("Spinning for 1 second");
+ arch::timer().spin_for(Duration::from_secs(1)); + arch::timer().spin_for(Duration::from_secs(1));
+ } + }
} }
@ -417,17 +417,14 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs
--- 07_uart_chainloader/src/print.rs --- 07_uart_chainloader/src/print.rs
+++ 08_timestamps/src/print.rs +++ 08_timestamps/src/print.rs
@@ -22,12 +22,70 @@ @@ -31,3 +31,71 @@
$crate::print::_print(format_args_nl!($($arg)*));
})
} }
+
/// Prints with a newline. +/// Prints am info, with newline.
-/// +#[macro_export]
-/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +macro_rules! info {
#[macro_export]
macro_rules! println {
() => ($crate::print!("\n"));
- ($($arg:tt)*) => ({
- $crate::print::_print(format_args_nl!($($arg)*));
+ ($string:expr) => ({ + ($string:expr) => ({
+ #[allow(unused_imports)] + #[allow(unused_imports)]
+ use crate::interface::time::Timer; + use crate::interface::time::Timer;
@ -490,8 +487,8 @@ diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs
+ timestamp_subsec_us modulo 1_000, + timestamp_subsec_us modulo 1_000,
+ $($arg)* + $($arg)*
+ )); + ));
}) + })
} +}
diff -uNr 07_uart_chainloader/src/relocate.rs 08_timestamps/src/relocate.rs diff -uNr 07_uart_chainloader/src/relocate.rs 08_timestamps/src/relocate.rs
--- 07_uart_chainloader/src/relocate.rs --- 07_uart_chainloader/src/relocate.rs

Binary file not shown.

Binary file not shown.

@ -65,22 +65,22 @@ fn kernel_main() -> ! {
use core::time::Duration; use core::time::Duration;
use interface::time::Timer; use interface::time::Timer;
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
println!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
arch::timer().resolution().as_nanos() arch::timer().resolution().as_nanos()
); );
println!("Drivers loaded:"); info!("Drivers loaded:");
for (i, driver) in bsp::device_drivers().iter().enumerate() { for (i, driver) in bsp::device_drivers().iter().enumerate() {
println!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }
// Test a failing timer case. // Test a failing timer case.
arch::timer().spin_for(Duration::from_nanos(1)); arch::timer().spin_for(Duration::from_nanos(1));
loop { loop {
println!("Spinning for 1 second"); info!("Spinning for 1 second");
arch::timer().spin_for(Duration::from_secs(1)); arch::timer().spin_for(Duration::from_secs(1));
} }
} }

@ -22,9 +22,19 @@ macro_rules! print {
} }
/// Prints with a newline. /// Prints with a newline.
///
/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html
#[macro_export] #[macro_export]
macro_rules! println { macro_rules! println {
() => ($crate::print!("\n")); () => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::print::_print(format_args_nl!($($arg)*));
})
}
/// Prints am info, with newline.
#[macro_export]
macro_rules! info {
($string:expr) => ({ ($string:expr) => ({
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::interface::time::Timer; use crate::interface::time::Timer;

Binary file not shown.

Binary file not shown.

@ -65,22 +65,22 @@ fn kernel_main() -> ! {
use core::time::Duration; use core::time::Duration;
use interface::time::Timer; use interface::time::Timer;
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
println!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
arch::timer().resolution().as_nanos() arch::timer().resolution().as_nanos()
); );
println!("Drivers loaded:"); info!("Drivers loaded:");
for (i, driver) in bsp::device_drivers().iter().enumerate() { for (i, driver) in bsp::device_drivers().iter().enumerate() {
println!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }
// Test a failing timer case. // Test a failing timer case.
arch::timer().spin_for(Duration::from_nanos(1)); arch::timer().spin_for(Duration::from_nanos(1));
loop { loop {
println!("Spinning for 1 second"); info!("Spinning for 1 second");
arch::timer().spin_for(Duration::from_secs(1)); arch::timer().spin_for(Duration::from_secs(1));
} }
} }

@ -22,9 +22,19 @@ macro_rules! print {
} }
/// Prints with a newline. /// Prints with a newline.
///
/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html
#[macro_export] #[macro_export]
macro_rules! println { macro_rules! println {
() => ($crate::print!("\n")); () => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::print::_print(format_args_nl!($($arg)*));
})
}
/// Prints am info, with newline.
#[macro_export]
macro_rules! info {
($string:expr) => ({ ($string:expr) => ({
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::interface::time::Timer; use crate::interface::time::Timer;

@ -359,16 +359,16 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch
+ exception, + exception,
+ exception::{Debug, SError, FIQ, IRQ}, + exception::{Debug, SError, FIQ, IRQ},
+ }; + };
+ use crate::println; + use crate::info;
+ +
+ let to_mask_str = |x: bool| -> &'static str { + let to_mask_str = |x: bool| -> &'static str {
+ if x { "Masked" } else { "Unmasked" } + if x { "Masked" } else { "Unmasked" }
+ }; + };
+ +
+ println!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>())); + info!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>()));
+ println!(" SError: {}", to_mask_str(exception::is_masked::<SError>())); + info!(" SError: {}", to_mask_str(exception::is_masked::<SError>()));
+ println!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>())); + info!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>()));
+ println!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>())); + info!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>()));
+ } + }
+} +}
@ -382,30 +382,30 @@ diff -uNr 09_hw_debug_JTAG/src/main.rs 10_privilege_level/src/main.rs
- use interface::time::Timer; - use interface::time::Timer;
+ use interface::{console::All, time::Timer}; + use interface::{console::All, time::Timer};
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
+ +
+ println!( + info!(
+ "Current privilege level: {}", + "Current privilege level: {}",
+ arch::state::current_privilege_level() + arch::state::current_privilege_level()
+ ); + );
+ println!("Exception handling state:"); + info!("Exception handling state:");
+ arch::state::print_exception_state(); + arch::state::print_exception_state();
+ +
println!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
arch::timer().resolution().as_nanos() arch::timer().resolution().as_nanos()
@@ -76,11 +84,12 @@ @@ -76,11 +84,12 @@
println!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }
- // Test a failing timer case. - // Test a failing timer case.
- arch::timer().spin_for(Duration::from_nanos(1)); - arch::timer().spin_for(Duration::from_nanos(1));
+ println!("Timer test, spinning for 1 second"); + info!("Timer test, spinning for 1 second");
+ arch::timer().spin_for(Duration::from_secs(1)); + arch::timer().spin_for(Duration::from_secs(1));
+ println!("Echoing input now"); + info!("Echoing input now");
loop { loop {
- println!("Spinning for 1 second"); - info!("Spinning for 1 second");
- arch::timer().spin_for(Duration::from_secs(1)); - arch::timer().spin_for(Duration::from_secs(1));
+ let c = bsp::console().read_char(); + let c = bsp::console().read_char();
+ bsp::console().write_char(c); + bsp::console().write_char(c);

Binary file not shown.

Binary file not shown.

@ -124,15 +124,15 @@ pub mod state {
exception, exception,
exception::{Debug, SError, FIQ, IRQ}, exception::{Debug, SError, FIQ, IRQ},
}; };
use crate::println; use crate::info;
let to_mask_str = |x: bool| -> &'static str { let to_mask_str = |x: bool| -> &'static str {
if x { "Masked" } else { "Unmasked" } if x { "Masked" } else { "Unmasked" }
}; };
println!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>())); info!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>()));
println!(" SError: {}", to_mask_str(exception::is_masked::<SError>())); info!(" SError: {}", to_mask_str(exception::is_masked::<SError>()));
println!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>())); info!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>()));
println!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>())); info!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>()));
} }
} }

@ -65,29 +65,29 @@ fn kernel_main() -> ! {
use core::time::Duration; use core::time::Duration;
use interface::{console::All, time::Timer}; use interface::{console::All, time::Timer};
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
println!( info!(
"Current privilege level: {}", "Current privilege level: {}",
arch::state::current_privilege_level() arch::state::current_privilege_level()
); );
println!("Exception handling state:"); info!("Exception handling state:");
arch::state::print_exception_state(); arch::state::print_exception_state();
println!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
arch::timer().resolution().as_nanos() arch::timer().resolution().as_nanos()
); );
println!("Drivers loaded:"); info!("Drivers loaded:");
for (i, driver) in bsp::device_drivers().iter().enumerate() { for (i, driver) in bsp::device_drivers().iter().enumerate() {
println!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }
println!("Timer test, spinning for 1 second"); info!("Timer test, spinning for 1 second");
arch::timer().spin_for(Duration::from_secs(1)); arch::timer().spin_for(Duration::from_secs(1));
println!("Echoing input now"); info!("Echoing input now");
loop { loop {
let c = bsp::console().read_char(); let c = bsp::console().read_char();
bsp::console().write_char(c); bsp::console().write_char(c);

@ -22,9 +22,19 @@ macro_rules! print {
} }
/// Prints with a newline. /// Prints with a newline.
///
/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html
#[macro_export] #[macro_export]
macro_rules! println { macro_rules! println {
() => ($crate::print!("\n")); () => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::print::_print(format_args_nl!($($arg)*));
})
}
/// Prints am info, with newline.
#[macro_export]
macro_rules! info {
($string:expr) => ({ ($string:expr) => ({
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::interface::time::Timer; use crate::interface::time::Timer;

@ -603,7 +603,7 @@ diff -uNr 10_privilege_level/src/arch/aarch64.rs 11_virtual_memory/src/arch/aarc
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Implementation of the kernel's architecture abstraction code // Implementation of the kernel's architecture abstraction code
@@ -136,3 +138,8 @@ @@ -136,3 +138,8 @@
println!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>())); info!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>()));
} }
} }
+ +
@ -846,16 +846,16 @@ diff -uNr 10_privilege_level/src/main.rs 11_virtual_memory/src/main.rs
panic!("Error loading driver: {}", i.compatible()) panic!("Error loading driver: {}", i.compatible())
@@ -67,6 +80,9 @@ @@ -67,6 +80,9 @@
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
+ println!("MMU online. Special regions:"); + info!("MMU online. Special regions:");
+ bsp::virt_mem_layout().print_layout(); + bsp::virt_mem_layout().print_layout();
+ +
println!( info!(
"Current privilege level: {}", "Current privilege level: {}",
arch::state::current_privilege_level() arch::state::current_privilege_level()
@@ -87,6 +103,13 @@ @@ -87,6 +103,13 @@
println!("Timer test, spinning for 1 second"); info!("Timer test, spinning for 1 second");
arch::timer().spin_for(Duration::from_secs(1)); arch::timer().spin_for(Duration::from_secs(1));
+ let remapped_uart = unsafe { bsp::driver::PL011Uart::new(0x1FFF_1000) }; + let remapped_uart = unsafe { bsp::driver::PL011Uart::new(0x1FFF_1000) };
@ -865,7 +865,7 @@ diff -uNr 10_privilege_level/src/main.rs 11_virtual_memory/src/main.rs
+ ) + )
+ .unwrap(); + .unwrap();
+ +
println!("Echoing input now"); info!("Echoing input now");
loop { loop {
let c = bsp::console().read_char(); let c = bsp::console().read_char();
@ -1013,10 +1013,10 @@ diff -uNr 10_privilege_level/src/memory.rs 11_virtual_memory/src/memory.rs
+ +
+ /// Print the memory layout. + /// Print the memory layout.
+ pub fn print_layout(&self) { + pub fn print_layout(&self) {
+ use crate::println; + use crate::info;
+ +
+ for i in self.inner.iter() { + for i in self.inner.iter() {
+ println!("{}", i); + info!("{}", i);
+ } + }
+ } + }
+} +}

Binary file not shown.

Binary file not shown.

@ -126,16 +126,16 @@ pub mod state {
exception, exception,
exception::{Debug, SError, FIQ, IRQ}, exception::{Debug, SError, FIQ, IRQ},
}; };
use crate::println; use crate::info;
let to_mask_str = |x: bool| -> &'static str { let to_mask_str = |x: bool| -> &'static str {
if x { "Masked" } else { "Unmasked" } if x { "Masked" } else { "Unmasked" }
}; };
println!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>())); info!(" Debug: {}", to_mask_str(exception::is_masked::<Debug>()));
println!(" SError: {}", to_mask_str(exception::is_masked::<SError>())); info!(" SError: {}", to_mask_str(exception::is_masked::<SError>()));
println!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>())); info!(" IRQ: {}", to_mask_str(exception::is_masked::<IRQ>()));
println!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>())); info!(" FIQ: {}", to_mask_str(exception::is_masked::<FIQ>()));
} }
} }

@ -78,29 +78,29 @@ fn kernel_main() -> ! {
use core::time::Duration; use core::time::Duration;
use interface::{console::All, time::Timer}; use interface::{console::All, time::Timer};
println!("Booting on: {}", bsp::board_name()); info!("Booting on: {}", bsp::board_name());
println!("MMU online. Special regions:"); info!("MMU online. Special regions:");
bsp::virt_mem_layout().print_layout(); bsp::virt_mem_layout().print_layout();
println!( info!(
"Current privilege level: {}", "Current privilege level: {}",
arch::state::current_privilege_level() arch::state::current_privilege_level()
); );
println!("Exception handling state:"); info!("Exception handling state:");
arch::state::print_exception_state(); arch::state::print_exception_state();
println!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
arch::timer().resolution().as_nanos() arch::timer().resolution().as_nanos()
); );
println!("Drivers loaded:"); info!("Drivers loaded:");
for (i, driver) in bsp::device_drivers().iter().enumerate() { for (i, driver) in bsp::device_drivers().iter().enumerate() {
println!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }
println!("Timer test, spinning for 1 second"); info!("Timer test, spinning for 1 second");
arch::timer().spin_for(Duration::from_secs(1)); arch::timer().spin_for(Duration::from_secs(1));
let remapped_uart = unsafe { bsp::driver::PL011Uart::new(0x1FFF_1000) }; let remapped_uart = unsafe { bsp::driver::PL011Uart::new(0x1FFF_1000) };
@ -110,7 +110,7 @@ fn kernel_main() -> ! {
) )
.unwrap(); .unwrap();
println!("Echoing input now"); info!("Echoing input now");
loop { loop {
let c = bsp::console().read_char(); let c = bsp::console().read_char();
bsp::console().write_char(c); bsp::console().write_char(c);

@ -138,10 +138,10 @@ impl<const NUM_SPECIAL_RANGES: usize> KernelVirtualLayout<{ NUM_SPECIAL_RANGES }
/// Print the memory layout. /// Print the memory layout.
pub fn print_layout(&self) { pub fn print_layout(&self) {
use crate::println; use crate::info;
for i in self.inner.iter() { for i in self.inner.iter() {
println!("{}", i); info!("{}", i);
} }
} }
} }

@ -22,9 +22,19 @@ macro_rules! print {
} }
/// Prints with a newline. /// Prints with a newline.
///
/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html
#[macro_export] #[macro_export]
macro_rules! println { macro_rules! println {
() => ($crate::print!("\n")); () => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::print::_print(format_args_nl!($($arg)*));
})
}
/// Prints am info, with newline.
#[macro_export]
macro_rules! info {
($string:expr) => ({ ($string:expr) => ({
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::interface::time::Timer; use crate::interface::time::Timer;

Loading…
Cancel
Save