public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed] arc: Update elfarcv2 script template
@ 2023-08-31  5:19 Claudiu Zissulescu
  0 siblings, 0 replies; only message in thread
From: Claudiu Zissulescu @ 2023-08-31  5:19 UTC (permalink / raw)
  To: binutils; +Cc: fbedard

Update ARC's elfarcv2 script template with:

- The .ivt section (Interrupt Vector Table) is mapped at the begining
  of STARTUP_MEMORY when ivtbase_addr is not defined. Previously, it
  was pointing to 0x00.

- MEMORY_FILE is a new emulation paramter and sets the name for the
  linker script file which holds the MEMORY commands required by
  arcv2elfx emulation.

- Four new linker variables are introduced available when arcv2elf emulation is used:
  * __TEXT_REGION_ORIGIN__ Once defined it is setting the text region origin. By default it points to zero.
  * __TEXT_REGION_LENGTH__ Once defined it is setting the text region length. By default it is set to 2M.
  * __DATA_REGION_ORIGIN__ Once defined it is setting the data region origin. By default it is set to 0x80000000.
  * __DATA_REGION_LENGTH__ Once defined it is setting the data region length. By default it is set to 2M.

ld/ChangeLog:

	* scripttempl/elfarcv2.sc: Update script template.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
---
 ld/scripttempl/elfarcv2.sc | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ld/scripttempl/elfarcv2.sc b/ld/scripttempl/elfarcv2.sc
index f1b8a69d090..3054e4c62f3 100644
--- a/ld/scripttempl/elfarcv2.sc
+++ b/ld/scripttempl/elfarcv2.sc
@@ -58,7 +58,7 @@ IVT="
  /* If the 'ivtbase_addr' symbol is defined, it indicates  the base address of
     the interrupt vectors.  See description of INT_VECTOR_BASE register.  */
 
- .ivt DEFINED (ivtbase_addr) ? ivtbase_addr : 0x00 :
+ .ivt DEFINED (ivtbase_addr) ? ivtbase_addr : ORIGIN(${STARTUP_MEMORY}) :
  {
    ${RELOCATING+ PROVIDE (__ivtbase_addr = .); }
    KEEP (*(.ivt));
@@ -104,21 +104,25 @@ fi
 #
 case $GENERIC_BOARD in
   yes|1|YES)
+	test -z "$MEMORY_FILE" && MEMORY_FILE="memory.x"
 	MEMORY_DEF="
 /* Get memory banks definition from some user configuration file.
    This file must be located in some linker directory (search path
    with -L<dir>). See fixed memory banks emulation script.  */
-INCLUDE memory.x;
+INCLUDE ${MEMORY_FILE};
 "
 	;;
   *)
-MEMORY_DEF="
-/* Fixed definition of the available memory banks.
-   See generic emulation script for a user defined configuration.  */
+	MEMORY_DEF="
+__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0x00;
+__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : ${ICCM_SIZE};
+__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : ${RAM_START_ADDR};
+__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : ${RAM_SIZE};
+
 MEMORY
 {
-    ICCM : ORIGIN = 0x00000000, LENGTH = ${ICCM_SIZE}
-    DCCM : ORIGIN = ${RAM_START_ADDR}, LENGTH = ${RAM_SIZE}
+    ICCM : ORIGIN = __TEXT_REGION_ORIGIN__, LENGTH = __TEXT_REGION_LENGTH__
+    DCCM : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__
 }
 "
 	;;
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-31  5:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31  5:19 [committed] arc: Update elfarcv2 script template Claudiu Zissulescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).