Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat: baremetalsupport aarch64 #412

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Annotate code.
Add code annotations to include TODOs.

Signed-off-by: Fritz Stracke <fritz.stracke@rwth-aachen.de>
fstracke committed Nov 19, 2024
commit edfd286f6c4137974e9569b4c61c37032e6623e0
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// "rust-analyzer.cargo.target": "aarch64-unknown-none-softfloat",
"rust-analyzer.cargo.target": "aarch64-unknown-none-softfloat",
// "rust-analyzer.cargo.target": "riscv64imac-unknown-none-elf",
"rust-analyzer.cargo.target": "x86_64-unknown-none",
// "rust-analyzer.cargo.target": "x86_64-unknown-none",
// "rust-analyzer.cargo.target": "x86_64-unknown-uefi",
"rust-analyzer.check.overrideCommand": [
"cargo",
10 changes: 6 additions & 4 deletions src/arch/aarch64/console.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use core::num::NonZeroU32;
use hermit_dtb::Dtb;

use crate::arch::drivers::qemu_serial::QemuSerial;
use crate::arch::drivers::xlnx_serial::XlnxSerial;
use crate::arch::drivers::SerialDriver;

pub struct Console {
stdout: XlnxSerial,
stdout: QemuSerial,
}

pub fn stdout() -> XlnxSerial {
///TODO: Rewrite to create serial driver available on target hardware (read from dtb)
pub fn stdout() -> QemuSerial {
/// Physical address of UART0 at Qemu's virt emulation
const SERIAL_PORT_ADDRESS: u32 = 0x09000000;

@@ -45,7 +47,7 @@ pub fn stdout() -> XlnxSerial {
} else {
SERIAL_PORT_ADDRESS
};
let mut serial = XlnxSerial::from_addr(NonZeroU32::new(0xff000000).unwrap());
let mut serial = QemuSerial::from_addr(NonZeroU32::new(uart_address).unwrap());
serial.init();
serial
}
@@ -60,7 +62,7 @@ impl Console {
}

pub(crate) fn set_stdout(&mut self, stdout: u32) {
self.stdout = XlnxSerial::from_addr(NonZeroU32::new(stdout).unwrap());
self.stdout = QemuSerial::from_addr(NonZeroU32::new(stdout).unwrap());
self.stdout.init();
}

1 change: 1 addition & 0 deletions src/arch/aarch64/drivers/qemu_serial.rs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ impl SerialDriver for QemuSerial {
self.regs.as_mut_ptr().out().write(c);
Success(c)
}
///TODO: Implement actual read functionality.
fn getc(&self) -> SerialSuccess<u8> {
Success('A' as u8)
}