This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: PRU Share memory

Part Number: AM5728


因项目需求正在开发PRU,但PRU只有12KB的指令RAM,所以考虑将代码分到两个PRU单元处理。

但两个PRU单元的数据交互就涉及到共享内存。查看了CMD文件,已有定义段:

/* Specify the System Memory Map */
MEMORY
{
PAGE 0:
PRU_IMEM : org = 0x00000000 len = 0x00003000 /* 12kB PRU Instruction RAM */

PAGE 1:

/* RAM */

PRU_DMEM_0_1 : org = 0x00000000 len = 0x00002000 CREGISTER=24 /* 8kB PRU Data RAM 0_1 */
PRU_DMEM_1_0 : org = 0x00002000 len = 0x00002000 CREGISTER=25 /* 8kB PRU Data RAM 1_0 */

PAGE 2:
PRU_SHAREDMEM : org = 0x00010000 len = 0x00008000 CREGISTER=28 /* 32kB Shared RAM */

...

}

所以在下面的SECTIONS段添加自己的数据到这个段中:

/* Specify the sections allocation into memory */
SECTIONS {

/* Forces _c_int00 to the start of PRU IRAM. Not necessary when */
/* loading an ELF file, but useful when loading a binary */

.text:_c_int00* > 0x0, PAGE 0
.text > PRU_IMEM, PAGE 0
.stack > PRU_DMEM_1_0, PAGE 1
.bss > PRU_DMEM_1_0, PAGE 1
.cio > PRU_DMEM_1_0, PAGE 1
.data > PRU_DMEM_1_0, PAGE 1
.switch > PRU_DMEM_1_0, PAGE 1
.sysmem > PRU_DMEM_1_0, PAGE 1
.cinit > PRU_DMEM_1_0, PAGE 1
.rodata > PRU_DMEM_1_0, PAGE 1
.rofardata > PRU_DMEM_1_0, PAGE 1
.farbss > PRU_DMEM_1_0, PAGE 1
.fardata > PRU_DMEM_1_0, PAGE 1
.resource_table > PRU_DMEM_1_0, PAGE 1

.ShareMemory > PRU_SHAREDMEM, PAGE 2
}

同时在主函数中添加:

#pragma DATA_SECTION(ShareMemRPMsg, "ShareMemory")
RPMsg_protocol_t ShareMemRPMsg;

但编译发现编译器一直寻找不到“ShareMemory”段,请问是我使用的方法有问题吗?

以下是报错信息:

Description Resource Path Location Type
#10247-D creating output section "ShareMemory" without a SECTIONS specification PRU_1_ICSS1_RPMsg C/C++ Problem