From cd60a3956da29350d2e79bd6458d5cd77a4a18d0 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Tue, 29 Aug 2023 11:52:06 +0300 Subject: [PATCH] arc: Update elfarcv2 script template 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 --- 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). 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