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]
};
/// The `#[repr(align(16384))]` is unfortunately ineffective. Hence we
/// require explicit linking to a region defined in the linker script.
#[repr(align(16384))]
pub struct L1Table {
table: [L1Entry; L1_TABLE_SIZE]

View File

@ -12,7 +12,7 @@ fn main() {
.unwrap();
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.
println!("cargo:rerun-if-changed=link.x");
}

View File

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