Files
nixos-configs/link.ld
Alexander Heldt 8c8a72df71 Add linking step
2024-08-03 11:55:27 +02:00

44 lines
874 B
Plaintext

ENTRY(reset);
MEMORY {
flash(rx) : ORIGIN = 0x08000000, LENGTH = 512K
sram(rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
stack_start = ORIGIN(sram) + LENGTH(sram); /* stack points to end of sram */
SECTIONS {
.isr_vector : {
. = ALIGN(4);
KEEP(*(.isr_vector))
. = ALIGN(4);
} > flash
.text : { /* code and constants */
. = ALIGN(4);
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
. = ALIGN(4);
} > flash
_data_addr = LOADADDR(.data);
.data : { /* intialized variables */
. = ALIGN(4);
_data_start = .;
*(.data)
*(.data.*)
. = ALIGN(4);
_data_end = .;
} > sram AT > flash /* loads the section into sram, with initial values stored in flash */
.bss : { /* unintialized variables */
. = ALIGN(4);
_bss_start = .;
*(.bss)
*(.bss.*)
_bss_end = .;
. = ALIGN(4);
} > sram
}