Skip to content

Commit

Permalink
ramconfig.ld: Update link script files to use GNSS RAM
Browse files Browse the repository at this point in the history
Add new sections to use GNSS RAM into link script files.
  • Loading branch information
SPRESENSE committed Feb 2, 2024
1 parent 5315875 commit 1f9e9f0
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x0d000000, LENGTH = 1536K
gnssram (rwx) : ORIGIN = 0x09000000, LENGTH = 640K
}

OUTPUT_ARCH(arm)
Expand All @@ -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)
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x0d000000, LENGTH = 1536K
gnssram (rwx) : ORIGIN = 0x09000000, LENGTH = 640K
}

OUTPUT_ARCH(arm)
Expand All @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 1f9e9f0

Please sign in to comment.