From 1f9e9f0e2fd881a3bd83677906d1af1fc76db8da Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:36:49 +0900 Subject: [PATCH] ramconfig.ld: Update link script files to use GNSS RAM Add new sections to use GNSS RAM into link script files. --- .../1.0.0/variants/spresense/ramconfig-new.ld | 45 ++++++++++++++++++- .../1.0.0/variants/spresense/ramconfig.ld | 45 ++++++++++++++++++- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig-new.ld b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig-new.ld index 12d08499d..9e1231a14 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig-new.ld +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig-new.ld @@ -21,6 +21,7 @@ MEMORY { ram (rwx) : ORIGIN = 0x0d000000, LENGTH = 1536K + gnssram (rwx) : ORIGIN = 0x09000000, LENGTH = 640K } OUTPUT_ARCH(arm) @@ -29,6 +30,47 @@ EXTERN(_vectors) /* Force the vectors to be included in the output */ EXTERN(__stack) /* Force the __stack to be included in the output */ SECTIONS { + /* GNSS memory */ + + .gnssram.text : { + _sgnsstext = ABSOLUTE(.); + + /* Possible to locate text of any object file. + * *libxxx.a:*.o(.text .text.*) + * *libxxx.a:*.o(.rodata .rodata.*) + */ + + } > gnssram + + .gnssram.data . : ALIGN(8) { + /* Possible to locate data of any object file. + * *libxxx.a:*.o(.data .data.*) + */ + + } > gnssram + + .gnssram.bss . (NOLOAD) : { + . = ALIGN(4); + _gnssramsbss = ABSOLUTE(.); + + /* Possible to locate bss of any object file. + * *libxxx.a:*.o(.bss .bss.*) + * *libxxx.a:*.o(COMMON) + */ + + . = ALIGN(4); + _gnssramebss = ABSOLUTE(.); + } > gnssram + + /* Whatever is left from the GNSS memory is used as a special heap. */ + + _sgnssheap = ABSOLUTE(.); + _egnssheap = ORIGIN(gnssram) + LENGTH(gnssram); + + ASSERT(_sgnssheap < _egnssheap, "Error: Out of memory") + + /* Application memory */ + .text : { _stext = ABSOLUTE(.); *(.vectors) @@ -50,7 +92,8 @@ SECTIONS .init_section : { _sinit = ABSOLUTE(.); - KEEP(*(.init_array .init_array.*)) + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) _einit = ABSOLUTE(.); } > ram diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig.ld b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig.ld index 19056a298..b14d1f570 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig.ld +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/variants/spresense/ramconfig.ld @@ -21,6 +21,7 @@ MEMORY { ram (rwx) : ORIGIN = 0x0d000000, LENGTH = 1536K + gnssram (rwx) : ORIGIN = 0x09000000, LENGTH = 640K } OUTPUT_ARCH(arm) @@ -29,6 +30,47 @@ EXTERN(_vectors) /* Force the vectors to be included in the output */ EXTERN(__stack) /* Force the __stack to be included in the output */ SECTIONS { + /* GNSS memory */ + + .gnssram.text : { + _sgnsstext = ABSOLUTE(.); + + /* Possible to locate text of any object file. + * *libxxx.a:*.o(.text .text.*) + * *libxxx.a:*.o(.rodata .rodata.*) + */ + + } > gnssram + + .gnssram.data . : ALIGN(8) { + /* Possible to locate data of any object file. + * *libxxx.a:*.o(.data .data.*) + */ + + } > gnssram + + .gnssram.bss . (NOLOAD) : { + . = ALIGN(4); + _gnssramsbss = ABSOLUTE(.); + + /* Possible to locate bss of any object file. + * *libxxx.a:*.o(.bss .bss.*) + * *libxxx.a:*.o(COMMON) + */ + + . = ALIGN(4); + _gnssramebss = ABSOLUTE(.); + } > gnssram + + /* Whatever is left from the GNSS memory is used as a special heap. */ + + _sgnssheap = ABSOLUTE(.); + _egnssheap = ORIGIN(gnssram) + LENGTH(gnssram); + + ASSERT(_sgnssheap < _egnssheap, "Error: Out of memory") + + /* Application memory */ + .text : { _stext = ABSOLUTE(.); *(.vectors) @@ -50,7 +92,8 @@ SECTIONS .init_section : { _sinit = ABSOLUTE(.); - KEEP(*(.init_array .init_array.*)) + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) _einit = ABSOLUTE(.); } > ram