Skip to content

Commit

Permalink
Merge pull request #62 from Miochyann/dev
Browse files Browse the repository at this point in the history
Add support for Raspi4. Fix dtb address in Raspi4.
  • Loading branch information
coolyjg authored Mar 18, 2024
2 parents 1cb22de + 58a5993 commit 247c4ca
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/driver_block/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ default = []
[dependencies]
log = "0.4"
driver_common = { path = "../driver_common" }
bcm2835-sdhci = { git = "https://github.com/lhw2002426/bcm2835-sdhci.git", rev = "e974f16", optional = true }
bcm2835-sdhci = { git = "https://github.com/lhw2002426/bcm2835-sdhci.git", rev = "bf07a72", optional = true }
8 changes: 6 additions & 2 deletions modules/ruxhal/src/platform/aarch64_raspi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ extern "C" {
fn rust_main_secondary(cpu_id: usize);
}

pub(crate) unsafe extern "C" fn rust_entry(cpu_id: usize, dtb: usize) {
pub(crate) unsafe extern "C" fn rust_entry(cpu_id: usize) {
crate::mem::clear_bss();
crate::arch::set_exception_vector_base(exception_vector_base as usize);
crate::arch::write_page_table_root0(0.into()); // disable low address access
unsafe {
// Set the physical address of the dtb file to 0x03000000 in config.txt
dtb::init(crate::mem::phys_to_virt(0x03000000.into()).as_ptr());
}
crate::cpu::init_primary(cpu_id);
super::aarch64_common::pl011::init_early();
super::aarch64_common::generic_timer::init_early();
rust_main(cpu_id, dtb);
rust_main(cpu_id, 0x03000000);
}

#[cfg(feature = "smp")]
Expand Down
1 change: 1 addition & 0 deletions platforms/aarch64-raspi4.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ kernel-base-vaddr = "0xffff_0000_0008_0000"
phys-virt-offset = "0xffff_0000_0000_0000"
# MMIO regions with format (`base_paddr`, `size`).
mmio-regions = [
["0xFE34_0000", "0x1000"], # SD card
["0xFE20_1000", "0x1000"], # PL011 UART
["0xFF84_1000", "0x8000"], # GICv2
]
Expand Down
4 changes: 2 additions & 2 deletions scripts/make/raspi4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ openocd:
## Start GDB session
##------------------------------------------------------------------------------
gdb: RUSTC_MISC_ARGS += -C debuginfo=2
gdb: $(KERNEL_ELF)
gdb: $(OUT_ELF)
$(call color_header, "Launching GDB")
@$(DOCKER_GDB) gdb-multiarch -q $(KERNEL_ELF)
@$(DOCKER_GDB) gdb-multiarch -q $(OUT_ELF)
Binary file added tools/raspi4/X1_JTAG_boot/jtag_boot_rpi4.img
Binary file not shown.

0 comments on commit 247c4ca

Please sign in to comment.