Skip to content

Commit

Permalink
feat(board): alloc more memory for vf2 board
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenRuiwei committed Aug 18, 2024
1 parent e7e68fd commit e19cfba
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ edition = "2021"

[dependencies]
paste = "1.0"

[features]
vf2 = []
2 changes: 1 addition & 1 deletion config/src/board.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
mm::{RAM_SIZE, VIRT_RAM_OFFSET, VIRT_START},
mm::{RAM_SIZE, VIRT_START},
utils::register_mut_const,
};

Expand Down
17 changes: 15 additions & 2 deletions config/src/mm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down
1 change: 1 addition & 0 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ strace = []
smp = []
preempt = []
debug = []
vf2 = ["config/vf2"]
3 changes: 3 additions & 0 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ endif
ifneq ($(DEBUG), )
FEATURES += debug
endif
ifneq ($(VF2), )
FEATURES += vf2
endif

CARGO_BUILD_ARGS :=
ifeq ($(MODE), release)
Expand Down

0 comments on commit e19cfba

Please sign in to comment.