From adea8a6d15f86eaabd208a4d5e14cf2f727c1358 Mon Sep 17 00:00:00 2001 From: Saurabh Singh Date: Sun, 10 Mar 2024 19:43:32 -0400 Subject: [PATCH] Refactor linker scripts --- sw/lib/link/link_bootloader.ld | 14 ++++++-------- sw/lib/link/link_hydrogensoc.ld | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sw/lib/link/link_bootloader.ld b/sw/lib/link/link_bootloader.ld index 7c44d6ff..f4c29186 100644 --- a/sw/lib/link/link_bootloader.ld +++ b/sw/lib/link/link_bootloader.ld @@ -13,15 +13,13 @@ ENTRY(_start) MEMORY { BOOT_ROM (rx): ORIGIN = 0x00010000, LENGTH = 8K - - CODE_RAM (rx): ORIGIN = 0x20000000, LENGTH = 40K - DATA_RAM (rwx): ORIGIN = 0x2000a000, LENGTH = 8K + RAM (rx): ORIGIN = 0x20000000, LENGTH = 48K } __bootrom_start = ORIGIN(BOOT_ROM); __bootrom_size = LENGTH(BOOT_ROM); -__approm_start = ORIGIN(CODE_RAM); -__approm_size = LENGTH(CODE_RAM); +__approm_start = ORIGIN(RAM); +__approm_size = LENGTH(RAM); SECTIONS @@ -70,7 +68,7 @@ SECTIONS . = ALIGN(4); _edata = .; - } > DATA_RAM AT> BOOT_ROM + } > RAM AT> BOOT_ROM /* ----- Uninitialized Data ----- */ @@ -86,10 +84,10 @@ SECTIONS . = ALIGN(4); _ebss = .; - } > DATA_RAM AT> BOOT_ROM + } > RAM AT> BOOT_ROM _end = .; } PROVIDE(_start_heap = _ebss); -PROVIDE(_stack_pointer = ORIGIN(DATA_RAM) + LENGTH(DATA_RAM)); \ No newline at end of file +PROVIDE(_stack_pointer = ORIGIN(RAM) + LENGTH(RAM)); \ No newline at end of file diff --git a/sw/lib/link/link_hydrogensoc.ld b/sw/lib/link/link_hydrogensoc.ld index d8e6c31c..12501eab 100644 --- a/sw/lib/link/link_hydrogensoc.ld +++ b/sw/lib/link/link_hydrogensoc.ld @@ -12,8 +12,8 @@ ENTRY(_start) /* MEMORY LAYOUT */ MEMORY { - CODE_RAM (rx): ORIGIN = 0x20000000, LENGTH = 40K - DATA_RAM (rwx): ORIGIN = 0x2000a000, LENGTH = 8K + CODE_RAM (rx): ORIGIN = 0x20000000, LENGTH = 36K + DATA_RAM (rwx): ORIGIN = (ORIGIN(CODE_RAM) + LENGTH(CODE_RAM)), LENGTH = 12K } __coderam_start = ORIGIN(CODE_RAM);