diff --git a/config/Cargo.toml b/config/Cargo.toml index a5761b9c..c4921d72 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -7,3 +7,6 @@ edition = "2021" [dependencies] paste = "1.0" + +[features] +vf2 = [] diff --git a/config/src/board.rs b/config/src/board.rs index 53a53401..d2084a75 100644 --- a/config/src/board.rs +++ b/config/src/board.rs @@ -1,5 +1,5 @@ use crate::{ - mm::{RAM_SIZE, VIRT_RAM_OFFSET, VIRT_START}, + mm::{RAM_SIZE, VIRT_START}, utils::register_mut_const, }; diff --git a/config/src/mm.rs b/config/src/mm.rs index 0086f6b9..bb3b5be0 100644 --- a/config/src/mm.rs +++ b/config/src/mm.rs @@ -3,9 +3,18 @@ use crate::{ utils::register_mut_const, }; +#[cfg(not(feature = "vf2"))] pub const RAM_START: usize = 0x8000_0000; -pub const VIRT_START: usize = 0xffff_ffc0_8000_0000; +#[cfg(feature = "vf2")] +pub const RAM_START: usize = 0x8000_0000; + +pub const HIGH_HALF: usize = 0xffff_ffc0_0000_0000; +pub const VIRT_START: usize = HIGH_HALF + RAM_START; + +#[cfg(not(feature = "vf2"))] pub const RAM_SIZE: usize = 128 * 1024 * 1024; +#[cfg(feature = "vf2")] +pub const RAM_SIZE: usize = 0x100000000 + RAM_START - 0x4000_0000; pub const VIRT_RAM_OFFSET: usize = KERNEL_START - KERNEL_START_PHYS; @@ -14,9 +23,13 @@ pub const KERNEL_START_PHYS: usize = RAM_START + KERNEL_OFFSET; pub const KERNEL_START: usize = VIRT_START + KERNEL_OFFSET; pub const KERNEL_STACK_SIZE: usize = 64 * 1024; + +#[cfg(not(feature = "vf2"))] pub const KERNEL_HEAP_SIZE: usize = 64 * 1024 * 1024; +#[cfg(feature = "vf2")] +pub const KERNEL_HEAP_SIZE: usize = 256 * 1024 * 1024; -pub const HART_START_ADDR: usize = 0x80200000; +pub const HART_START_ADDR: usize = RAM_START + KERNEL_START; register_mut_const!(pub DTB_ADDR, usize, 0); diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 983b57e7..03e43cfb 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -54,3 +54,4 @@ strace = [] smp = [] preempt = [] debug = [] +vf2 = ["config/vf2"] diff --git a/kernel/Makefile b/kernel/Makefile index b24892d5..bab03068 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -12,6 +12,9 @@ endif ifneq ($(DEBUG), ) FEATURES += debug endif +ifneq ($(VF2), ) + FEATURES += vf2 +endif CARGO_BUILD_ARGS := ifeq ($(MODE), release)