Add linking step

This commit is contained in:
Alexander Heldt
2024-06-22 19:20:43 +02:00
parent 4c77450e47
commit 8c8a72df71
8 changed files with 5643 additions and 1 deletions

43
link.ld Normal file
View File

@@ -0,0 +1,43 @@
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
}