[PATCH] ld: pru: Add pru_irq_map output section
Dimitar Dimitrov
dimitar@dinux.eu
Sun Nov 28 17:42:07 GMT 2021
Describe the .pru_irq_map section, which the PRU remoteproc
host loader introduced in Linux kernel 5.10:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c75c9fdac66efd8b54773368254ef330c276171b
I tested this change on the following setup:
- Linux kernel 5.10.65-ti-r30 from Beagleboard.org.
- PRU firmware compiled from TI example:
Hands_on_Labs/lab_5/solution/am335x/PRU_RPMsg_Echo_Interrupt1
included in TI PRU software package version 6.0.
ld/ChangeLog:
* scripttempl/pru.sc (.pru_irq_map): Define output section.
* testsuite/ld-pru/pru_irq_map-1.d: New test.
* testsuite/ld-pru/pru_irq_map-2.d: New test.
* testsuite/ld-pru/pru_irq_map.s: New test.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
ld/scripttempl/pru.sc | 6 ++++++
ld/testsuite/ld-pru/pru_irq_map-1.d | 17 +++++++++++++++++
ld/testsuite/ld-pru/pru_irq_map-2.d | 10 ++++++++++
ld/testsuite/ld-pru/pru_irq_map.s | 20 ++++++++++++++++++++
4 files changed, 53 insertions(+)
create mode 100644 ld/testsuite/ld-pru/pru_irq_map-1.d
create mode 100644 ld/testsuite/ld-pru/pru_irq_map-2.d
create mode 100644 ld/testsuite/ld-pru/pru_irq_map.s
diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc
index 97d8be0a0a4..56d07bea15d 100644
--- a/ld/scripttempl/pru.sc
+++ b/ld/scripttempl/pru.sc
@@ -183,6 +183,12 @@ SECTIONS
${RELOCATING+ . += __STACK_SIZE ; }
} ${RELOCATING+ > dmem}
+ /* Remoteproc loader in Linux kernel 5.10 and later reads this section
+ to setup the PRUSS interrupt controller. The interrupt map section
+ is never referenced from PRU firmware, so there is no need to
+ place it in the target dmem memory. */
+ .pru_irq_map 0 : { *(.pru_irq_map) }
+
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
diff --git a/ld/testsuite/ld-pru/pru_irq_map-1.d b/ld/testsuite/ld-pru/pru_irq_map-1.d
new file mode 100644
index 00000000000..bbdf5b6ce4e
--- /dev/null
+++ b/ld/testsuite/ld-pru/pru_irq_map-1.d
@@ -0,0 +1,17 @@
+#name: pru_irq_map special section for host
+#source: pru_irq_map.s
+#ld: --defsym=__HEAP_SIZE=0 --defsym=__STACK_SIZE=0
+#readelf: -l --wide
+
+# Ensure that .pru_irq_map section is not loaded into target memory.
+
+#...
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align
+ +LOAD +0x[0-9a-f]+ 0x0+ 0x0+ 0x0+8 0x0+8 RW 0x1
+ +LOAD +0x[0-9a-f]+ 0x20+ 0x20+ 0x0+4 0x0+4 R E 0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.data[ ]*
+ +01 +.text[ ]*
diff --git a/ld/testsuite/ld-pru/pru_irq_map-2.d b/ld/testsuite/ld-pru/pru_irq_map-2.d
new file mode 100644
index 00000000000..31665955de7
--- /dev/null
+++ b/ld/testsuite/ld-pru/pru_irq_map-2.d
@@ -0,0 +1,10 @@
+#name: pru_irq_map special section for host
+#source: pru_irq_map.s
+#ld: --defsym=__HEAP_SIZE=0 --defsym=__STACK_SIZE=0
+#readelf: -S --wide
+
+# Ensure that .pru_irq_map section is present.
+
+#...
+ +\[[ 0-9]+\] +.pru_irq_map +PROGBITS +0+ +[0-9a-f]+ +0+5 +00 +0 +0 +1
+#...
diff --git a/ld/testsuite/ld-pru/pru_irq_map.s b/ld/testsuite/ld-pru/pru_irq_map.s
new file mode 100644
index 00000000000..b38d0373a65
--- /dev/null
+++ b/ld/testsuite/ld-pru/pru_irq_map.s
@@ -0,0 +1,20 @@
+
+ .text
+ .global _start
+_start:
+ nop
+
+ .data
+my_global_var:
+ .byte 10
+ .byte 11
+ .byte 12
+ .byte 13
+
+ .section .pru_irq_map,"",@progbits
+my_intc_map:
+ .byte 0
+ .byte 1
+ .byte 19
+ .byte 1
+ .byte 1
--
2.33.1
More information about the Binutils
mailing list