diff options
| author | Nathan Lee <me@nwlee.tech> | 2026-06-19 20:19:22 -0500 |
|---|---|---|
| committer | Nathan Lee <me@nwlee.tech> | 2026-06-19 20:19:22 -0500 |
| commit | 3ba80868b455858082cae0c4e902d27ce24d97ed (patch) | |
| tree | 927e7784c93cb2238bf117fab85e82233a80a66e | |
| parent | 039afedbc80eea82266c324b6548d59dcd746098 (diff) | |
change from wdt to dtb parsing
reference commit 039afedbc80eea82266c324b6548d59dcd746098
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | src/main.rs | 16 |
2 files changed, 8 insertions, 11 deletions
@@ -1,3 +1,4 @@ /target /.idea -wkern.bin
\ No newline at end of file +wkern.bin +*.dtb
\ No newline at end of file diff --git a/src/main.rs b/src/main.rs index bb1d735..69134ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,13 +10,15 @@ use std::io::Write; const MEMORY_SIZE: usize = 64 * 1024 * 1024; const REGISTER_NAME_WIDTH: u32 = 0b11111; const RO_TARGET: u32 = 0x80000000; -const WDT_LOCATION: u32 = 0x90000000; +const FDT_LOCATION: u32 = 0x90000000; const UART_ADDR: u32 = 0x10000000; fn main() { let path = std::path::PathBuf::from("wkern.bin"); let f_dat = std::fs::read(path).expect("Unable to read file"); + let dtb_dat = std::fs::read(std::path::PathBuf::from("v1.dtb")).expect("Unable to read file"); + let memory = Memory::new(MEMORY_SIZE); let mut state = CpuState::new(memory); @@ -27,20 +29,14 @@ fn main() { .unwrap(); state .memory - .write_multiple_bytes(WDT_LOCATION as usize, &[ - 65, 65, 103, 103, //0x67674141 - 1, 0, 0, 0, // 1 (n_devices) - 0, 0, 0, 0, // 0 (device type, free RAM) - 0, 0, 0, 0, // 0 (free RAM, no driver) - 0, 0, 0, 16, // 0x10000000 (start addr) - 0, 0, 0, 3 // 48 MB (size) - ], 99) + .write_multiple_bytes(FDT_LOCATION as usize, dtb_dat.as_slice(), 99) .unwrap(); state.memory.write(UART_ADDR as usize, 99, 0).unwrap(); state.pc = RO_TARGET; - state.registers[10] = WDT_LOCATION; + state.registers[10] = 0; + state.registers[11] = FDT_LOCATION; loop { { |
