From 0c214e4afc6fb8dd4f1e955a8303f71a4f0a7662 Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Mon, 23 Mar 2026 00:55:24 -0400 Subject: [PATCH] Fix linker script to be more generic --- vb.ld | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/vb.ld b/vb.ld index a9be021..9adb790 100644 --- a/vb.ld +++ b/vb.ld @@ -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 }