TI中文支持网
TI专业的中文技术问题搜集分享网站

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

Nancy Wang:

看使用方法没有问题,更换编译器版本试试。

www.ti.com/…/spruhv7b.pdf

,

Loading:

感谢回复,修复问题,却另外报错:

relocation from function "appl_LoopTask" to symbol "aaa" overflowed; the 17-bit relocated address 0x10000 is too large to encode in the 16-bit field (type = 'R_PRU_FOR_U16_C32_So8s16_PCM0XFFFFFFFF' (9), file = "./Application/StateMachine/appl_StateMachine.obj", offset = 0x00000014, section = ".text:appl_LoopTask")

未查找到相关的解决方案,如果有建议,非常感谢

,

Nancy Wang:

以下链接参考看一下

e2e.ti.com/…/relocation-from-function-to-symbol

software-dl.ti.com/…/17003.html

,

Loading:

谢谢,原因是长短指针修饰符的问题

赞(0)
未经允许不得转载:TI中文支持网 » AM5728: PRU Share memory
分享到: 更多 (0)