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.

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";

       请问要如何操作?

  • #program DATA_SECTION针对数据空间
    #program code_SECTION针对程序空间
  • 你好,c64xplus-iqmath_2_01_04_00这个只有lib库文件和头文件,怎么执行
    #program DATA_SECTION针对数据空间
    #program code_SECTION针对程序空间
  • 使用以上两个指令是针对具体的变量和函数的,你是针对整个lib文件吗?可能没有办法。
  • 例程里面是使用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
    -heap 0x5000

    MEMORY{
    UDRAM : o = 0x11f04000, l = 0x00010000 /* Unitialialized Data RAM */

    ERAM : o = 0x81000000, l = 0x00100000
    UERAM : 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

    }
  • 可以的。详细内容请查看7.3.3 Providing a Supplemental Linker Command File
    www.ti.com/.../spruex3v.pdf
  • 目前根据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
  • 对于IQmath_c64x+_elf.lib,这个怎么操作

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

    .fardata:IQexpTableMinMax
    * 0 00800a08 000000f0 UNINITIALIZED
    00800a08 000000f0 IQmath_RAM_c64x+_elf.lib : IQmathTables.obj (.fardata:IQexpTableMinMax)

    .fardata:IQexpTableCoeff
    * 0 00800af8 00000028 UNINITIALIZED
    00800af8 00000028 IQmath_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文件是
    97d9e320 000000a0 IQmath_c64x+_elf.lib : IQNcosPU.obj (.text)
    97d9e3c0 000000a0 : IQNsinPU.obj (.text)
    没有具体的段,不知道应该怎么重定位
  • 能否通过#program code_SECTION将需要的函数放到自定义的段,然后再通过Program.sectMap重定位?
  • 非常感谢你的帮助
  • 你好。我将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/Half Auto-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: G O 4.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

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    L2SRAM 00800000 00020000 00000000 00020000 RW X
    L1PSRAM 00e00000 00004000 00000340 00003cc0 RW X
    L1DSRAM 00f00000 00004000 00000b1c 000034e4 RW
    OCMC_RAM1 40300000 00080000 00000000 00080000 RW X
    OCMC_RAM2 40400000 00100000 00000000 00100000 RW X
    OCMC_RAM3 40500000 00100000 00000000 00100000 RW X
    SR_0 97b00000 00100000 00100000 00000000 RW X
    EXT_CODE 97d00000 00800000 000acea0 00753160 RW X
    EXT_DATA 98500000 01800000 01078f50 007870b0 RW
    EXT_HEAP 99d00000 00300000 00000000 00300000 RW
    TRACE_BUF 9f000000 00060000 00008004 00057ffc RW
    EXC_DATA 9f060000 00010000 00000000 00010000 RW
    PM_DATA 9f070000 00020000 00000000 00020000 RW X
    CMEM a6800000 08000000 00000000 08000000 RW


    SEGMENT ALLOCATION MAP

    run origin load origin length init length attrs members
    ---------- ----------- ---------- ----------- ----- -------
    00e00000 00e00000 00000340 00000340 r-x
    00e00000 00e00000 00000340 00000340 r-x IQFuncs
    00f00000 00f00000 00000a04 00000a04 r--
    00f00000 00f00000 00000a04 00000a04 r-- .const:IQsinTable
    00f00a08 00f00a08 00000118 00000000 rw-
    00f00a08 00f00a08 000000f0 00000000 rw- .fardata:IQexpTableMinMax
    00f00af8 00f00af8 00000028 00000000 rw- .fardata:IQexpTableCoeff
    97d00000 97d00000 000006e0 000006e0 rw-
    97d00000 97d00000 000006e0 000006e0 rw- .resource_table
    97d006e0 97d006e0 000ac5c0 000ac5c0 r-x
    97d006e0 97d006e0 000ac5c0 000ac5c0 r-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_BASE 0x40800000
    #define DSP_L2_RAM_BASE 0x40800000
    #define DSP_L2_RAM_SIZE 0x48000

    #define L1D_RAM_BASE 0x40f00000
    #define DSP_L1D_RAM_BASE 0x40f00000
    #define DSP_L1D_RAM_SIZE 0x4000

    #define L1P_RAM_BASE 0x40e00000
    #define DSP_L1P_RAM_BASE 0x40e00000
    #define DSP_L1P_RAM_SIZE 0x4000

    struct my_resource_table ti_ipc_remoteproc_ResourceTable增加以下2项
    {//L1D
    TYPE_DEVMEM,
    DSP_L1D_RAM_BASE, DSP_L1D_RAM_BASE,
    DSP_L1D_RAM_SIZE, 0, 0, "DSP_L1D_RAM_BASE",
    },

    {//L1P
    TYPE_DEVMEM,
    L1P_RAM_BASE, DSP_L1P_RAM_BASE,
    DSP_L1P_RAM_SIZE, 0, 0, "DSP_L1P_RAM_BASE",
    },

    请问是哪里出现了问题,是少修改文件还是其他地方设置有误?
  • 我使用的系统版本是

    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

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