1
0
Fork 0

link.x: reduce alignment, use all remaining OCM for .stack

This commit is contained in:
Astro 2020-04-28 02:48:31 +02:00
parent b88e14ea07
commit 282b4dc69a
3 changed files with 10 additions and 12 deletions

View File

@ -101,8 +101,6 @@ pub static mut l1_table: L1Table = L1Table {
table: [L1Entry(0); L1_TABLE_SIZE] table: [L1Entry(0); L1_TABLE_SIZE]
}; };
/// The `#[repr(align(16384))]` is unfortunately ineffective. Hence we
/// require explicit linking to a region defined in the linker script.
#[repr(align(16384))] #[repr(align(16384))]
pub struct L1Table { pub struct L1Table {
table: [L1Entry; L1_TABLE_SIZE] table: [L1Entry; L1_TABLE_SIZE]

View File

@ -12,7 +12,7 @@ fn main() {
.unwrap(); .unwrap();
println!("cargo:rustc-link-search={}", out.display()); println!("cargo:rustc-link-search={}", out.display());
// Only re-run the build script when memory.x is changed, // Only re-run the build script when link.x is changed,
// instead of when any part of the source code changes. // instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=link.x"); println!("cargo:rerun-if-changed=link.x");
} }

View File

@ -1,7 +1,5 @@
ENTRY(_boot_cores); ENTRY(_boot_cores);
STACK_SIZE = 0x8000;
/* Provide some defaults */ /* Provide some defaults */
PROVIDE(Reset = _boot_cores); PROVIDE(Reset = _boot_cores);
PROVIDE(UndefinedInstruction = Reset); PROVIDE(UndefinedInstruction = Reset);
@ -38,21 +36,21 @@ SECTIONS
*(.data .data.*); *(.data .data.*);
} > OCM } > OCM
.bss (NOLOAD) : ALIGN(0x4000) .bss (NOLOAD) : ALIGN(4)
{ {
__bss_start = .;
/* Aligned to 16 kB */ /* Aligned to 16 kB */
KEEP(*(.bss.l1_table)); KEEP(*(.bss.l1_table));
*(.bss .bss.*); *(.bss .bss.*);
. = ALIGN(4); . = ALIGN(4);
__bss_end = .;
} > OCM } > OCM
__bss_start = ADDR(.bss);
__bss_end = ADDR(.bss) + SIZEOF(.bss);
.stack (NOLOAD) : ALIGN(0x1000) { .stack (NOLOAD) : ALIGN(8) {
. += STACK_SIZE; __stack_end = .;
. = ORIGIN(OCM) + LENGTH(OCM) - 8;
__stack_start = .;
} > OCM } > OCM
__stack_end = ADDR(.stack);
__stack_start = ADDR(.stack) + SIZEOF(.stack);
/DISCARD/ : /DISCARD/ :
{ {
@ -62,3 +60,5 @@ SECTIONS
*(.ARM.extab.*); *(.ARM.extab.*);
} }
} }
ASSERT(SIZEOF(.stack) >= 0x8000, "less than 32 KB left for stack");