今天在OMAPL138上尝试进行PRU的开发,但是出现如下的链接问题:
<Linking>
"../main.c", line 8: warning #17003-D: relocation from function "main" to symbol "Init_G" overflowed; the 30-bit relocated address 0x31ec132f is too large to encode in the 16-bit unsigned field (type = 'R_PRU_FRDO_U16_AD4_C32_So8s16_P0XFFFFFFFC' (6), file = "./main.obj", offset = 0x00000008, section = ".text:main")
不知道如何解决该问题!使用的是ti-cgt-pru_2.1.5的编译器,用C语言开发的源代码!
COM文件如下:
-cr /* Link using C conventions */
/* Specify the System Memory Map */
MEMORY
{
PAGE 0:
PRU_IMEM : org = 0x00000000 len = 0x00001000 /* 4kB PRU Instruction RAM */
PAGE 1:
/* RAM */
PRU_DMEM_0_1 : org = 0x00000000 len = 0x00000200 CREGISTER=24 /* 512B PRU Data RAM 0_1 */
PRU_DMEM_1_0 : org = 0x00002000 len = 0x00000200 CREGISTER=25 /* 512B PRU Data RAM 1_0 */
// PRU_SHAREDMEM : org = 0x00010000 len = 0x00008000 CREGISTER=28 /* 32kB Shared RAM */
DDR : org = 0xC7B00000 len = 0x00100000 CREGISTER=31
// L3OCMC : org = 0x40000000 len = 0x00010000 CREGISTER=30
/* Peripherals */
PRU_CFG : org = 0x00026000 len = 0x00000120 CREGISTER=4
// PRU_ECAP : org = 0x00030000 len = 0x00000060 CREGISTER=3
// PRU_IEP : org = 0x0002E000 len = 0x0000031C CREGISTER=26
PRU_INTC : org = 0x00020000 len = 0x00001504 CREGISTER=0
// PRU_UART : org = 0x00028000 len = 0x00000038 CREGISTER=7
// MCASP3_DMA : org = 0x46000000 len = 0x00000100 CREGISTER=8
// I2C3 : org = 0x48060000 len = 0x00000300 CREGISTER=5
RSVD1 : org = 0x48040000 len = 0x0000005C CREGISTER=1
RSVD2 : org = 0x4802A000 len = 0x000000D8 CREGISTER=2
RSVD3 : org = 0x00030000 len = 0x00000060 CREGISTER=3
RSVD5 : org = 0x48060000 len = 0x00000300 CREGISTER=5
RSVD6 : org = 0x48030000 len = 0x000001A4 CREGISTER=6
RSVD7 : org = 0x00028000 len = 0x00000038 CREGISTER=7
RSVD8 : org = 0x46000000 len = 0x00000100 CREGISTER=8
RSVD9 : org = 0x4A100000 len = 0x0000128C CREGISTER=9
RSVD10 : org = 0x48318000 len = 0x00000100 CREGISTER=10
RSVD11 : org = 0x48022000 len = 0x00000088 CREGISTER=11
RSVD12 : org = 0x48024000 len = 0x00000088 CREGISTER=12
RSVD13 : org = 0x48310000 len = 0x00000100 CREGISTER=13
RSVD14 : org = 0x481CC000 len = 0x000001E8 CREGISTER=14
RSVD15 : org = 0x481D0000 len = 0x000001E8 CREGISTER=15
RSVD16 : org = 0x481A0000 len = 0x000001A4 CREGISTER=16
RSVD17 : org = 0x4819C000 len = 0x000000D8 CREGISTER=17
RSVD18 : org = 0x48300000 len = 0x000002C4 CREGISTER=18
RSVD19 : org = 0x48302000 len = 0x000002C4 CREGISTER=19
RSVD20 : org = 0x48304000 len = 0x000002C4 CREGISTER=20
RSVD21 : org = 0x00032400 len = 0x00000100 CREGISTER=21
RSVD22 : org = 0x480C8000 len = 0x00000140 CREGISTER=22
RSVD23 : org = 0x480CA000 len = 0x00000880 CREGISTER=23
RSVD26 : org = 0x0002E000 len = 0x0000031C CREGISTER=26
RSVD27 : org = 0x00032000 len = 0x00000100 CREGISTER=27
RSVD28 : org = 0x00010000 len = 0x00008000 CREGISTER=28
RSVD29 : org = 0x49000000 len = 0x00001098 CREGISTER=29
RSVD30 : org = 0x40000000 len = 0x00010000 CREGISTER=30
}
/* 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 > DDR, PAGE 1
.stack > DDR, PAGE 1
.bss > DDR, PAGE 1
.cio > DDR, PAGE 1
.data > DDR, PAGE 1
.switch > DDR, PAGE 1
.sysmem > DDR, PAGE 1
.cinit > DDR, PAGE 1
.rodata > DDR, PAGE 1
.rofardata > DDR, PAGE 1
.farbss > DDR, PAGE 1
.fardata > DDR, PAGE 1
.resource_table > PRU_DMEM_0_1, PAGE 1
}
请问需要如何修改呢?看来很多例子都是说要使用汇编语言开发的,但是,我看这个编译器应该可以支持C/C++的。有没有相应的实例提供参考一下,或者开发文档之类的资料也行,谢谢!
Shine:
这个错误信息请先按照下面wiki网站上的方法修改试试。
processors.wiki.ti.com/…/17003
user4755476:
回复 Tony Tang:
OK,明白了,我还以为PRU也可以直接在DDR上执行指令呢!那样PRU只适合实现一些比较小的功能了!谢谢!
Tony Tang:
回复 user4755476:
是的,很小,4Kbyte指令空间,也就最大1K条指令。