File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ fn add_linker_script(arch_width: u32) -> io::Result<()> {
1111 let mut content = fs:: read_to_string ( "link.x.in" ) ?;
1212 content = content. replace ( "${ARCH_WIDTH}" , & arch_width. to_string ( ) ) ;
1313
14+ // Single core devices can use the entire stack, no need to limit it.
15+ let hart_stack_size = if env:: var_os ( "CARGO_FEATURE_SINGLE_HART" ) . is_some ( ) {
16+ "SIZEOF(.stack)"
17+ } else {
18+ "2K"
19+ } ;
20+
21+ content = content. replace ( "${HART_STACK_SIZE}" , hart_stack_size) ;
22+
1423 // Get target-dependent linker configuration and replace ${INCLUDE_LINKER_FILES} with it
1524 let mut include_content = String :: new ( ) ;
1625
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ ${INCLUDE_LINKER_FILES}
7272PROVIDE(_stext = ORIGIN(REGION_TEXT));
7373PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
7474PROVIDE(_max_hart_id = 0);
75- PROVIDE(_hart_stack_size = 2K );
75+ PROVIDE(_hart_stack_size = ${HART_STACK_SIZE} );
7676PROVIDE(_heap_size = 0);
7777
7878SECTIONS
You can’t perform that action at this time.
0 commit comments