Fix linker script to be more generic

This commit is contained in:
Simon Gellis 2026-03-23 00:55:24 -04:00
parent 7c8ce09516
commit 0c214e4afc
No known key found for this signature in database
GPG Key ID: DA576912FED9577B
1 changed files with 7 additions and 11 deletions

18
vb.ld
View File

@ -10,13 +10,10 @@ MEMORY {
rom (rx): ORIGIN = 0x07000000, LENGTH = 16M
}
__text_vma = 0x07000000;
__data_vma = 0x05000000;
SECTIONS
{
/* Read-only sections, merged into text segment: */
.text __text_vma : {
.text ORIGIN(rom) : {
*(.text)
*(.text.*)
/* .gnu.warning sections are handled specially by elf32.em. */
@ -63,7 +60,7 @@ SECTIONS
/* Ram memory */
__data_lma = .;
.data __data_vma : AT(__data_lma) {
.data ORIGIN(ram) : AT(__data_lma) {
*(.data)
*(.data.*)
*(.sdata)
@ -74,7 +71,7 @@ SECTIONS
__data_end = .;
.bss : {
.bss (NOLOAD) : {
*(.dynbss)
*(.bss)
*(.sdata)
@ -88,11 +85,10 @@ SECTIONS
/* Prevent overlaps with vbvectors */
__sections_size = SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.data);
__rom_size = 1 << LOG2CEIL(__sections_size + 0x220);
__rom_end = ORIGIN(rom) + __rom_size;
__rom_header_start = ORIGIN(rom) + __rom_size - 0x220;
/* Place interupt and reset vector at end of rom */
.vbvectors 0x07FFFDE0 : AT(__rom_end - 0x220) {
KEEP (*(.vbvectors))
} >rom = 0xFF
.rom_header 0x07FFFDE0 : AT(__rom_header_start) {
KEEP (*(.rom_header))
} >rom
}