Skip to content

Commit fd5d1a2

Browse files
authored
Merge pull request #96 from TexasInstruments/a0226750_rpmsg_echo
Add Linux RPMsg Echo example
2 parents 48430da + 81a2c52 commit fd5d1a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5014
-12
lines changed

docs/using_older_sdks_with_open_pru.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,25 @@ number to represent each kind of modification.
5858

5959
</details>
6060

61+
<details>
62+
<summary>AM62x</summary>
63+
64+
| SDK | Mandatory modifications | Optional modifications |
65+
| --------------- | ----------------------- | ---------------------- |
66+
| Linux 9.0-10.1 | | [5] |
67+
| Linux 11.0 | | [6] |
68+
69+
</details>
70+
6171
<details>
6272
<summary>AM64x</summary>
6373

6474
| SDK | Mandatory modifications | Optional modifications |
6575
| --------------- | ----------------------- | ---------------------- |
6676
| MCU+ 8.6 - 9.2 | [1] [2] | [4] |
6777
| MCU+ 10.0 | [1] | [4] |
78+
| Linux 9.0-10.1 | | [5] |
79+
| Linux 11.0 | | [6] |
6880

6981
</details>
7082

@@ -76,6 +88,10 @@ number to represent each kind of modification.
7688

7789
[4. Update MCU+ source/pru_io/firmware/common code](#4-update-mcu-sourcepru_iofirmwarecommon-code). Affects: PRU code
7890

91+
[5. Revert RPMsg channel name from rpmsg-raw to rpmsg-pru](#5-revert-rpmsg-channel-name-from-rpmsg-raw-to-rpmsg-pru). Affects: PRU firmware w/ RPMsg code
92+
93+
[6. Apply patch to enable PRU RPMsg](#6-apply-patch-to-enable-pru-rpmsg). Affects: Linux RPMsg kernel driver
94+
7995
## 1. Update SysConfig version
8096

8197
Affects: PRU code
@@ -139,3 +155,29 @@ There have been bugfixes to the macros in MCU+ sdk source/pru_io/firmware/common
139155
over the last few years. If your project has a dependency on any macros in this
140156
directory, you may want to use the latest version of those files:
141157
https://github.com/TexasInstruments/mcupsdk-core/commits/next/source/pru_io/firmware/common
158+
159+
## 5. Revert RPMsg channel name from rpmsg-raw to rpmsg-pru
160+
161+
Starting in Linux kernel 6.12, we removed the separate PRU RPMsg (RPMessage)
162+
driver[1], and use the generic RPMsg character driver for communication with PRU
163+
instead [2].
164+
165+
[1] linux-x.y.z/drivers/rpmsg/rpmsg_pru.c
166+
[2] linux-x.y.z/drivers/rpmsg/rpmsg_char.c
167+
168+
The generic Linux RPMsg character driver uses a different channel name
169+
(rpmsg-raw) than the previous PRU RPMsg driver (rpmsg-pru). In order to get
170+
PRU RPMsg firmware to work with Linux kernel 6.1 or 6.6, revert the PRU RPMsg
171+
firmware from using rpmsg-raw to use rpmsg-pru instead.
172+
173+
In other words, revert this patch from the earlier PRU Software Support Package:
174+
[Linux kernel 6.12: update rpmsg-pru to rpmsg-raw](https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/commit/?id=e4127728b027f42deb0b88dfdf8b3483cba45e85)
175+
176+
## 6. Apply patch to enable PRU RPMsg
177+
178+
Linux SDK 11.0 (Linux kernel 6.12) requires a Linux kernel patch in order to
179+
enable PRU RPMsg. The patch is not required if using SDK 10.1 or earlier, or
180+
SDK 11.1 or later.
181+
182+
For more details, refer to
183+
[[FAQ] AM62x & AM64x: How to enable PRU RPMsg on Processor SDK Linux 11.0](https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1494495/faq-am62x-am64x-how-to-enable-pru-rpmsg-on-processor-sdk-linux-11-0).

examples/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include ../imports.mak
33
SUBDIRS := \
44
custom_frequency_generator empty empty_c \
55
fft/split_radix_fft_4k_single_core fft/split_radix_fft_post_processing \
6-
LCD_interface logic_scope pru_emif spi_loopback
6+
LCD_interface logic_scope pru_emif rpmsg_echo_linux spi_loopback
77

88
# "make" or "make all" builds projects that match $(DEVICE) set in imports.mak
99
all: ARGUMENTS = all
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectSpec>
3+
<applicability>
4+
<when>
5+
<context
6+
deviceFamily="PRU"
7+
deviceId="AM62x_SK_EVM"
8+
/>
9+
</when>
10+
</applicability>
11+
12+
<project
13+
title="rpmsg_echo_linux"
14+
name = "rpmsg_echo_linux_am62x-sk_pruss0_pru0_fw_ti-pru-cgt"
15+
products="com.ti.OPEN_PRU"
16+
configurations="
17+
Release,
18+
Debug,
19+
"
20+
connection="TIXDS110_Connection.xml"
21+
toolChain="TI"
22+
cgtVersion="2.3.3"
23+
device="AM62x_SK_EVM"
24+
deviceCore="PRU_ICSS_PRU_0"
25+
ignoreDefaultDeviceSettings="true"
26+
ignoreDefaultCCSSettings="true"
27+
endianness="little"
28+
outputFormat="ELF"
29+
outputType="executable"
30+
31+
compilerBuildOptions="
32+
-I${CG_TOOL_ROOT}/include
33+
-I${OPEN_PRU_PATH}/source
34+
-O2
35+
"
36+
linkerBuildOptions="
37+
-m=rpmsg_echo_linux.${ConfigName}.map
38+
--disable_auto_rts
39+
--entry_point=main
40+
--diag_suppress=10063-D
41+
"
42+
43+
description="RPMsg Echo example with Linux">
44+
45+
<configuration name="Debug"
46+
compilerBuildOptions="
47+
-D_DEBUG_=1
48+
"
49+
linkerBuildOptions="
50+
"
51+
></configuration>
52+
<configuration name="Release"
53+
compilerBuildOptions="
54+
"
55+
linkerBuildOptions="
56+
"
57+
></configuration>
58+
<pathVariable name="OPEN_PRU_PATH" path="${COM_TI_OPEN_PRU_INSTALL_DIR}" scope="project" />
59+
<file path="../../../main.c" openOnCreation="false" excludeFromBuild="false" action="copy">
60+
</file>
61+
<file path="./linker.cmd" openOnCreation="false" excludeFromBuild="false" action="copy">
62+
</file>
63+
<file path="./intc_map.h" openOnCreation="false" excludeFromBuild="false" action="copy">
64+
</file>
65+
<file path="../../../../../../source/include/c_code/linux/resource_table.h" openOnCreation="false" excludeFromBuild="false" action="copy">
66+
</file>
67+
</project>
68+
</projectSpec>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifndef _INTC_MAP_H_
2+
#define _INTC_MAP_H_
3+
4+
/*
5+
* ======== PRU INTC Map ========
6+
*
7+
* Define the INTC mapping for interrupts going to the ICSS / ICSSG:
8+
* ICSS Host interrupts 0, 1
9+
* ICSSG Host interrupts 0, 1, 10-19
10+
*
11+
* Note that INTC interrupts going to the ARM Linux host should not be defined
12+
* in this file (ICSS/ICSSG Host interrupts 2-9).
13+
*
14+
* The INTC configuration for interrupts going to the ARM host should be defined
15+
* in the device tree node of the client driver, "interrupts" property.
16+
* See Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.yaml
17+
* entry #interrupt-cells for more.
18+
*
19+
* For example, on ICSSG:
20+
*
21+
* &client_driver0 {
22+
* interrupt-parent = <&icssg0_intc>;
23+
* interrupts = <21 2 2>, <22 3 3>;
24+
* interrupt-names = "interrupt_name1", "interrupt_name2";
25+
* };
26+
*/
27+
28+
#include <stddef.h>
29+
#include <rsc_types.h>
30+
31+
/*
32+
* .pru_irq_map is used by the RemoteProc driver during initialization. However,
33+
* the map is NOT used by the PRU firmware. That means DATA_SECTION and RETAIN
34+
* are required to prevent the PRU compiler from optimizing out .pru_irq_map.
35+
*/
36+
#pragma DATA_SECTION(my_irq_rsc, ".pru_irq_map")
37+
#pragma RETAIN(my_irq_rsc)
38+
39+
struct pru_irq_rsc my_irq_rsc = {
40+
0, /* type = 0 */
41+
1, /* number of system events being mapped */
42+
{
43+
{17, 0, 0}, /* {sysevt, channel, host interrupt} */
44+
},
45+
};
46+
47+
#endif /* _INTC_MAP_H_ */
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* AM62x_PRU0.cmd
3+
*
4+
* Example Linker command file for linking programs built with the C compiler
5+
* on AM62x PRU0 cores
6+
*/
7+
8+
-cr /* Link using C conventions */
9+
10+
/* Specify the System Memory Map */
11+
MEMORY
12+
{
13+
PAGE 0:
14+
/* 16 KB PRU Instruction RAM */
15+
PRU_IMEM : org = 0x00000000 len = 0x00004000
16+
17+
PAGE 1:
18+
/* Data RAMs */
19+
/* 8 KB PRU Data RAM 0 */
20+
PRU0_DMEM_0 : org = 0x00000000 len = 0x00002000 CREGISTER=24
21+
/* 8 KB PRU Data RAM 1 */
22+
PRU0_DMEM_1 : org = 0x00002000 len = 0x00002000 CREGISTER=25
23+
24+
PAGE 2:
25+
/* C28 needs to be programmed to point to SHAREDMEM, default is 0 */
26+
/* 32 KB PRU Shared RAM */
27+
PRU_SHAREDMEM : org = 0x00010000 len = 0x00008000 CREGISTER=28
28+
29+
/* Internal Peripherals */
30+
/* NOTE: Use full INTC length instead of 0x200 to match the pruIntc
31+
* structure definition in pru_intc.h, ignoring the second Constant
32+
* Register #6 that starts at 0x200 offset within INTC */
33+
PRU_INTC : org = 0x00020000 len = 0x00001504 CREGISTER=0
34+
PRU_IEP1 : org = 0x0002F000 len = 0x00000100 CREGISTER=1
35+
PRU_IEP1_0x100 : org = 0x0002F100 len = 0x0000021C CREGISTER=2
36+
PRU_ECAP : org = 0x00030000 len = 0x00000060 CREGISTER=3
37+
PRU_CFG : org = 0x00026000 len = 0x00000100 CREGISTER=4
38+
PRU_CFG_0x100 : org = 0x00026100 len = 0x00000098 CREGISTER=5
39+
/* PRU_INTC_0x200 is part of INTC space, and is therefore commented
40+
* out as it conflicts with PRU_INTC size above. To use PRU_INTC_0x200,
41+
* split up the pruIntc structure and CT_INTC variable in
42+
* source/include/c_code/PROCESSOR/pru_intc.h */
43+
/*PRU_INTC_0x200: org = 0x00020200 len = 0x00001304 CREGISTER=6*/
44+
PRU_UART : org = 0x00028000 len = 0x00000038 CREGISTER=7
45+
PRU_IEP0_0x100 : org = 0x0002E100 len = 0x0000021C CREGISTER=8
46+
PRU0_CTRL : org = 0x00022000 len = 0x00000030 CREGISTER=11
47+
PRU_RAT0 : org = 0x00008000 len = 0x00000854 CREGISTER=22
48+
PRU_IEP0 : org = 0x0002E000 len = 0x00000100 CREGISTER=26
49+
50+
/* External Regions */
51+
/* Random length 0x100 assigned to the below regions */
52+
RSVD9 : org = 0x00033000 len = 0x0000100 CREGISTER=9
53+
RSVD10 : org = 0x0002A000 len = 0x0000100 CREGISTER=10
54+
RSVD12 : org = 0x00027000 len = 0x0000100 CREGISTER=12
55+
RSVD13 : org = 0x0002C000 len = 0x0000100 CREGISTER=13
56+
RSVD14 : org = 0x00024800 len = 0x0000100 CREGISTER=14
57+
RSVD15 : org = 0x60000000 len = 0x0000100 CREGISTER=15
58+
RSVD16 : org = 0x70000000 len = 0x0000100 CREGISTER=16
59+
RSVD17 : org = 0x80000000 len = 0x0000100 CREGISTER=17
60+
RSVD18 : org = 0x90000000 len = 0x0000100 CREGISTER=18
61+
RSVD19 : org = 0xA0000000 len = 0x0000100 CREGISTER=19
62+
RSVD20 : org = 0xB0000000 len = 0x0000100 CREGISTER=20
63+
RSVD21 : org = 0x00032400 len = 0x0000100 CREGISTER=21
64+
RSVD23 : org = 0xC0000000 len = 0x0000100 CREGISTER=23
65+
RSVD27 : org = 0x00032000 len = 0x0000100 CREGISTER=27
66+
/* length 0x10000 (max len value) assigned to programmable C29-31*/
67+
RSVD29 : org = 0xD0000000 len = 0x00010000 CREGISTER=29
68+
RSVD30 : org = 0xE0000000 len = 0x00010000 CREGISTER=30
69+
RSVD31 : org = 0xF0000000 len = 0x00010000 CREGISTER=31
70+
}
71+
72+
/* Specify the sections allocation into memory */
73+
SECTIONS {
74+
/* Forces _c_int00 to the start of PRU IRAM. Not necessary when loading
75+
an ELF file, but useful when loading a binary */
76+
.text:_c_int00* > 0x0, PAGE 0
77+
78+
.text > PRU_IMEM, PAGE 0
79+
.stack > PRU0_DMEM_0, PAGE 1
80+
.bss > PRU0_DMEM_0, PAGE 1
81+
.cio > PRU0_DMEM_0, PAGE 1
82+
.data > PRU0_DMEM_0, PAGE 1
83+
.switch > PRU0_DMEM_0, PAGE 1
84+
.sysmem > PRU0_DMEM_0, PAGE 1
85+
.cinit > PRU0_DMEM_0, PAGE 1
86+
.rodata > PRU0_DMEM_0, PAGE 1
87+
.rofardata > PRU0_DMEM_0, PAGE 1
88+
.farbss > PRU0_DMEM_0, PAGE 1
89+
.fardata > PRU0_DMEM_0, PAGE 1
90+
91+
/* Ensure resource_table section is aligned on 8-byte address for
92+
ARMv8 (64-bit) kernel */
93+
.resource_table : ALIGN (8) > PRU0_DMEM_0, PAGE 1
94+
95+
.pru_irq_map (COPY) :
96+
{
97+
*(.pru_irq_map)
98+
}
99+
}

0 commit comments

Comments
 (0)