Skip to content

Commit 4915e9b

Browse files
authored
Merge pull request #175 from epilys/examples-aarch64-enable-uart-qemu
examples/aarch64: initialize uart device
2 parents d435c89 + 7bd800e commit 4915e9b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/aarch64/src/logger.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ struct Logger {
1717
pub fn init(max_level: LevelFilter) -> Result<(), SetLoggerError> {
1818
// Safe because BASE_ADDRESS is the base of the MMIO region for a UART and is mapped as device
1919
// memory.
20-
let uart = unsafe { Uart::new(UART_BASE_ADDRESS) };
20+
#[cfg_attr(platform = "crosvm", allow(unused_mut))]
21+
let mut uart = unsafe { Uart::new(UART_BASE_ADDRESS) };
22+
#[cfg(platform = "qemu")]
23+
uart.init(50000000, 115200);
2124
LOGGER.uart.lock().replace(uart);
2225

2326
log::set_logger(&LOGGER)?;

0 commit comments

Comments
 (0)