Skip to content

Commit 467fbfc

Browse files
committed
Split stack into equal parts based on number of harts
1 parent e12539f commit 467fbfc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- Main function no longer needs to be close to _start. A linker script may copy
1313
all code to RAM and keep .init in flash/ROM.
14+
- By default, the stack is now split into equal parts based on the number of
15+
harts.
1416

1517
### Fixed
1618

riscv-rt/link.x.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ ${INCLUDE_LINKER_FILES}
7272
PROVIDE(_stext = ORIGIN(REGION_TEXT));
7373
PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
7474
PROVIDE(_max_hart_id = 0);
75-
PROVIDE(_hart_stack_size = 2K);
75+
PROVIDE(_hart_stack_size = SIZEOF(.stack) / (_max_hart_id + 1));
7676
PROVIDE(_heap_size = 0);
7777

7878
SECTIONS

riscv-rt/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@
9090
//!
9191
//! This symbol defines stack area size for *one* hart.
9292
//!
93-
//! If omitted this symbol value will default to 2K.
93+
//! If omitted this symbol value will default to `SIZEOF(.stack) / (_max_hart_id + 1)`.
94+
//!
95+
//! Note that due to alignment, each individual stack may differ slightly in
96+
//! size.
9497
//!
9598
//! ### `_stack_start`
9699
//!

0 commit comments

Comments
 (0)