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

ccs6.1.3的Rtsc工程,怎么将iqmath库的数据、代码放到特定的段中

Other Parts Discussed in Thread:AM5728

        ccs6.1.3的Rtsc工程,使用到了c64xplus-iqmath_2_01_04_00库,编译后查看map文件,发现使用到几个函数;由于效率还是由点不太理想,想把这些iqmath函数和数据,固定放到L1/L2中去;设想是将L1/L2设置小一点,这样就有空余的L1/L2静态段空间可以使用,但是由于iqmath的数据和函数没有归集到特定的section中,不知道怎么将这些内容收集到一个section,然后指定到L1/L2里面去。如:

Program.sectMap[".IqMath"] = "L2SRAM";

       请问要如何操作?

Nancy Wang:

#program DATA_SECTION针对数据空间
#program code_SECTION针对程序空间

,

Kevin Le82:

你好,c64xplus-iqmath_2_01_04_00这个只有lib库文件和头文件,怎么执行
#program DATA_SECTION针对数据空间
#program code_SECTION针对程序空间

,

Nancy Wang:

使用以上两个指令是针对具体的变量和函数的,你是针对整个lib文件吗?可能没有办法。

,

Kevin Le82:

例程里面是使用cmd文件的,rtsc工程是自动生成cmd的,还能增加自定义cmd文件吗?
/**Copyright 2006 by Texas Instruments Incorporated.*All rights reserved. Property of Texas Instruments Incorporated.*Restricted rights to use, duplicate or disclose this code are*granted through contract.*/
/**======== dotprod_IQ.cmd ========**/

-stack 0x2000
-heap0x5000

MEMORY{UDRAM: o = 0x11f04000, l = 0x00010000/* Unitialialized Data RAM */
ERAM: o = 0x81000000, l = 0x00100000UERAM: o = 0x81100000, l = 0x05E00000
}

SECTIONS{/********************//* Generic sections *//********************/.text: > ERAM.data: > ERAM.cinit: > ERAM.pinit: > ERAM.const: > ERAM.switch: > ERAM.args: > ERAM .tables: > ERAM.stack: fill=0xc0ffee > ERAM.reset: > ERAM.csl_vect: > ERAM
.cio: > ERAM.bss: > ERAM.sysmem: > ERAM.far: > ERAM
rts_sect: {-lrts64plus.lib (.text)} > ERAM

}

,

Nancy Wang:

可以的。详细内容请查看7.3.3 Providing a Supplemental Linker Command File
www.ti.com/…/spruex3v.pdf

,

Kevin Le82:

目前根据map文件中使用到的IQ*,只能这么写:
Program.sectMap[".fardata:IQexpTableMinMax"] = "L2SRAM";
Program.sectMap[".fardata:IQexpTableCoeff"] = "L2SRAM";
Program.sectMap[".const:IQsinTable"] = "L2SRAM";

参考例程里面的cmd文件的写法,使用
.data:IQmathTables
.data:IQmath
无法重定位到L2SRAM

而且IQMath库的代码都编译在段.Text,这个集合了整个程序的.Text有点大,没办法放到L2SRAM

,

Kevin Le82:

对于IQmath_c64x+_elf.lib,这个怎么操作

,

Kevin Le82:

以下从map文件可以找到,编译有效
Program.sectMap[".fardata:IQexpTableMinMax"] = "L2SRAM";
Program.sectMap[".fardata:IQexpTableCoeff"] = "L2SRAM";
Program.sectMap[".const:IQsinTable"] = "L2SRAM";
原map显示
.const:IQsinTable
*00080000000000a040080000000000a04IQmath_RAM_c64x+_elf.lib : IQmathTables.obj (.const:IQsinTable)

.fardata:IQexpTableMinMax
*000800a08000000f0UNINITIALIZED00800a08000000f0IQmath_RAM_c64x+_elf.lib : IQmathTables.obj (.fardata:IQexpTableMinMax)

.fardata:IQexpTableCoeff
*000800af800000028UNINITIALIZED00800af800000028IQmath_RAM_c64x+_elf.lib : IQmathTables.obj (.fardata:IQexpTableCoeff)

一下从map文件无法直接找到,按猜想写,但是编译无效
1、IQmath数据猜想是在.fardata,但是不知道具体名字
Program.sectMap[".fardata:IQmathTables"] = "L2SRAM";
Program.sectMap[".fardata:IQmath"] = "L2SRAM";

2、IQmath函数,有下划线、无下划线都不成功
Program.sectMap[".text:_IQNcosPU"] = "L2SRAM";
Program.sectMap[".text:_IQNexp"] = "L2SRAM";
Program.sectMap[".text:_IQNsinPU"] = "L2SRAM";
对于函数,map文件是97d9e320000000a0IQmath_c64x+_elf.lib : IQNcosPU.obj (.text)97d9e3c0000000a0: IQNsinPU.obj (.text)
没有具体的段,不知道应该怎么重定位

,

Nancy Wang:

能否通过#program code_SECTION将需要的函数放到自定义的段,然后再通过Program.sectMap重定位?

,

Kevin Le82:

参考这个连接就可以了
software-dl.ti.com/…/sdto_cgt_Linker-Command-File-Primer.html

,

Kevin Le82:

非常感谢你的帮助

,

Nancy Wang:

感谢分享!

,

Kevin Le82:

你好。我将IQmath的函数、数据放到L2SRam后,感觉效率提升不是很明显,所以将L1cache设小,得到L1DSRam、L1PSram。我将IQmath的函数、数据分别放到对应的sram中,但是程序加载不成功。
平台环境:am5728的DSP核运行ti-rtos,ccs6.13,arm核运行linux
启动时加载错位信息如下:
[10.128031] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@97C00000
[10.138952]remoteproc0: 40800000.dsp is available
[10.143864]remoteproc0: Note: remoteproc is still under development and considered experimental.
[10.154471]remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
GetSockObjectByName(OTSERVICE_NAME) fail "languageswitch:"
libpng warning: iCCP: known incorrect sRGB profile
sh: ./numlockx: No such file or directory
socket fd: 9
PHY xx – 0/HalfAuto-negotiation: on Unknown! (0)
Unknown! (255)Down
"speed=0 duplex=0 autoneg=1 link=0"
eth0 is Down!!!
[OK] Started gdbserverproxy.service.Starting thermal-zone-init.service…
[OK] Started thermal-zone-init.service.
/sbin/ldconfig: /lib/libstdc++.so.6.0.21-gdb.py is not an ELF file – it has the wrong magic bytes at the start.

[10.376612]remoteproc0: registered virtio0 (type 7)
[10.389528]remoteproc0: powering up 40800000.dsp
[10.405569]remoteproc0: Booting fw image dra7-dsp1-fw.xe66, size 11228812
[10.419366] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
[10.425281] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[10.506093]remoteproc0: bad phdr da 0xe00000 mem 0x340
[10.511440]remoteproc0: Failed to load program segments: -22
[10.517416]remoteproc0: failed to unmap 8388608/19922944
[10.524626]remoteproc0: failed to unmap 25165824/0
[10.529670]remoteproc0: failed to unmap 3145728/16777216
[10.555036]remoteproc0: failed to unmap 104857600/1048576
[10.561615]remoteproc0: failed to unmap 1089470464/37748736
[10.567435]remoteproc0: failed to unmap 1088421888/1048576
[10.591591]remoteproc0: rproc_boot() failed -22
[10.596340] virtio_rpmsg_bus: probe of virtio0 failed with error -22
[12.193746]remoteproc1: releasing 41000000.dsp
[12.240622] cpsw 48484000.ethernet eth0: Link is Up – 100Mbps/Full – flow control off
[12.248565] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[12.400708] omap-rproc 41000000.dsp: assigned reserved memory node dsp2_cma@A0400000
[12.408536]remoteproc1: 41000000.dsp is available
[12.413433]remoteproc1: Note: remoteproc is still under development and considered experimental.
[12.424275]remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[12.554250]remoteproc1: powering up 41000000.dsp
[12.559086]remoteproc1: Booting fw image dra7-dsp2-fw.xe66, size 8537912
[12.572665] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
[12.578581] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
[12.609362]remoteproc1: remote processor 41000000.dsp is now up
[12.615756] ————[ cut here ]————
[12.620396] WARNING: CPU: 0 PID: 4 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x368()
[12.629741] 44000000.ocp:L3 Custom Error: MASTER DSP2_DMA TARGET L4_PER3_P3 (Idle): Data Access in User mode during Functional access
[12.641787] Modules linked in: virtio_rpmsg_bus bc_example(O) sha512_generic sha512_arm sha1_generic sha1_arm_neon sha1_arm md5 jitterentropy_rng sha256_generic sha256_arm hmac drbg des_generic cbc xfrm_user xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo sch_fq_codel uio_module_drv(O) uio gdbserverproxy(O) pwm_fan cryptodev(O) pwm_omap_dmtimer cmemk(O) pvrsrvkm(O) omap_wdt rtc_omap m25p80 extcon_palmas omap_rng rng_core debugss_kmodule(O) omap_remoteproc remoteproc virtio virtio_ring
[12.686043] CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GO4.4.19-g1c6ad78 #1
[12.694164] Hardware name: Generic DRA74X (Flattened Device Tree)
[12.700283] Workqueue: events request_firmware_work_func
[12.705619] Backtrace:

编译文件的map部分信息
===========================================================
MEMORY CONFIGURATION
nameoriginlengthusedunusedattrfill
——————————————————————-L2SRAM00800000000200000000000000020000RW XL1PSRAM00e00000000040000000034000003cc0RW XL1DSRAM00f000000000400000000b1c000034e4RWOCMC_RAM140300000000800000000000000080000RW XOCMC_RAM240400000001000000000000000100000RW XOCMC_RAM340500000001000000000000000100000RW XSR_097b00000001000000010000000000000RW XEXT_CODE97d0000000800000000acea000753160RW XEXT_DATA985000000180000001078f50007870b0RWEXT_HEAP99d00000003000000000000000300000RWTRACE_BUF9f000000000600000000800400057ffcRWEXC_DATA9f060000000100000000000000010000RWPM_DATA9f070000000200000000000000020000RW XCMEMa6800000080000000000000008000000RW

SEGMENT ALLOCATION MAP

run originload originlengthinit length attrs members
——————— ———- ———– —– ——-
00e0000000e000000000034000000340r-x00e0000000e000000000034000000340r-x IQFuncs
00f0000000f0000000000a0400000a04r–00f0000000f0000000000a0400000a04r– .const:IQsinTable
00f00a0800f00a080000011800000000rw-00f00a0800f00a08000000f000000000rw- .fardata:IQexpTableMinMax00f00af800f00af80000002800000000rw- .fardata:IQexpTableCoeff
97d0000097d00000000006e0000006e0rw-97d0000097d00000000006e0000006e0rw- .resource_table
97d006e097d006e0000ac5c0000ac5c0r-x97d006e097d006e0000ac5c0000ac5c0r-x .text

=====================================================

LINKER GENERATED COPY TABLES

__TI_cinit_table @ 99578f48 records: 7, size/record: 8, table size: 56.fardata: load addr=99576d68, load size=0000204e bytes, run addr=9950bf00, run size=000539e2 bytes, compression=rle.fardata:IQexpTableMinMax: load addr=99578db8, load size=000000f5 bytes, run addr=00f00a08, run size=000000f0 bytes, compression=rle.neardata: load addr=99578eb0, load size=0000003d bytes, run addr=99576998, run size=00000194 bytes, compression=rle.fardata:IQexpTableCoeff: load addr=99578ef0, load size=0000002e bytes, run addr=00f00af8, run size=00000028 bytes, compression=rle.bss: load addr=99578f2c, load size=00000008 bytes, run addr=99576958, run size=0000003c bytes, compression=zero_init.far: load addr=99578f34, load size=00000008 bytes, run addr=98500000, run size=0100beb0 bytes, compression=zero_init.tracebuf: load addr=99578f3c, load size=00000008 bytes, run addr=9f000000, run size=00008004 bytes, compression=zero_init

==========================================================
rsc_table_vayu_dsp.c文件修改如下:
/* DSP Memory Map */
#define L2_RAM_BASE0x40800000
#define DSP_L2_RAM_BASE0x40800000
#define DSP_L2_RAM_SIZE0x48000

#define L1D_RAM_BASE0x40f00000
#define DSP_L1D_RAM_BASE0x40f00000
#define DSP_L1D_RAM_SIZE0x4000

#define L1P_RAM_BASE0x40e00000
#define DSP_L1P_RAM_BASE0x40e00000
#define DSP_L1P_RAM_SIZE0x4000

struct my_resource_table ti_ipc_remoteproc_ResourceTable增加以下2项{//L1DTYPE_DEVMEM,DSP_L1D_RAM_BASE, DSP_L1D_RAM_BASE,DSP_L1D_RAM_SIZE, 0, 0, "DSP_L1D_RAM_BASE",},
{//L1PTYPE_DEVMEM,L1P_RAM_BASE, DSP_L1P_RAM_BASE,DSP_L1P_RAM_SIZE, 0, 0, "DSP_L1P_RAM_BASE",},

请问是哪里出现了问题,是少修改文件还是其他地方设置有误?

,

Kevin Le82:

会不会是和这个问题一样:

e2e.ti.com/…/rtos-am5728-unable-to-boot-dsp-with-heap-in-l1d-sram

,

Kevin Le82:

我使用的系统版本是

root@am57xx-evm:~# cat /proc/version
Linux version 4.4.19-g1c6ad78 (zhangwutan@tronlong-virtual-machine) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #1 SMP PREEMPT Wed Nov 11 16:33:34 HKT 2020

按理说应该已经修正了这个问题才对

赞(0)
未经允许不得转载:TI中文支持网 » ccs6.1.3的Rtsc工程,怎么将iqmath库的数据、代码放到特定的段中
分享到: 更多 (0)