[binutils-gdb] PRU: Add alignment for resource table, and allow sizes of memory regions to be set from the command

Nick Clifton nickc@sourceware.org
Mon May 10 12:58:54 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=261980de18b895d270dc7876d22b706db696e669

commit 261980de18b895d270dc7876d22b706db696e669
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date:   Mon May 10 13:58:17 2021 +0100

    PRU: Add alignment for resource table, and allow sizes of memory regions to be set from the command line.
    
    ld      * scripttempl/pru.sc (.resource_table): Add ALIGN directive.
            Use symbols for memory sizes.

Diff:
---
 ld/ChangeLog          |  5 +++++
 ld/scripttempl/pru.sc | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index b7a6adc372a..b66e72281ea 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-10  Dimitar Dimitrov  <dimitar@dinux.eu>
+
+	* scripttempl/pru.sc (.resource_table): Add ALIGN directive.
+	Use symbols for memory sizes.
+
 2021-05-08  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.am (html-local, doc/ld/index.html): New targets.
diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc
index 08aceaa3b2c..b2c941b7911 100644
--- a/ld/scripttempl/pru.sc
+++ b/ld/scripttempl/pru.sc
@@ -5,10 +5,14 @@ OUTPUT_ARCH(${ARCH})
 EOF
 
 test -n "${RELOCATING}" && cat <<EOF
+/* Allow memory sizes to be overridden from command line.  */
+__IMEM_SIZE = DEFINED(__IMEM_SIZE) ? __IMEM_SIZE : $TEXT_LENGTH;
+__DMEM_SIZE = DEFINED(__DMEM_SIZE) ? __DMEM_SIZE : $DATA_LENGTH;
+
 MEMORY
 {
-  imem   (x)   : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH
-  dmem   (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
+  imem   (x)   : ORIGIN = $TEXT_ORIGIN, LENGTH = __IMEM_SIZE
+  dmem   (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DMEM_SIZE
 }
 
 __HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32;
@@ -149,6 +153,9 @@ SECTIONS
 
   .resource_table ${RELOCATING-0} :
   {
+    /* Linux remoteproc loader requires the resource table address
+       to be aligned to 8 bytes.  */
+    ${RELOCATING+. = ALIGN(8);}
     KEEP (*(.resource_table))
   } ${RELOCATING+ > dmem}


More information about the Binutils-cvs mailing list