我将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",
},
请问是哪里出现了问题,是少修改文件还是其他地方设置有误?
Nancy Wang:
请问之前是将代码和数据放在哪段内存空间,arm端是可以加载成功的吗?
我需要咨询一下相关工程师再给您回复。
,
Kevin Le82:
你好,原来没有配置时,放在EXT_CODE、EXT_DATA,后来想提高速度,就放在L2SRAM但是效果不明显,所以想试试放L1看效果;结果就是现在这样,加载不成功。请问你们那边有配置到L1SRAM的例程吗?
目前项目是ARM核跑linux,DSP跑ti-rtos,DSP程序由系统启动时加载。
,
Kevin Le82:
今天想分配一块不进行cache的内存块,
1、在bld文件中增加以下定义:var EXT_NOCACHE_DSP1 = { name: "EXT_NOCACHE", base: 0x9A000000, len: 0x01000000, space: "data", access: "RW" };
Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = { externalMemoryMap: [ [ EXT_CODE_DSP1.name, EXT_CODE_DSP1 ], [ EXT_DATA_DSP1.name, EXT_DATA_DSP1 ], [ EXT_HEAP_DSP1.name, EXT_HEAP_DSP1 ], [ EXT_NOCACHE_DSP1.name, EXT_NOCACHE_DSP1 ], [ TRACE_BUF.name , TRACE_BUF ], [ EXC_DATA.name , EXC_DATA ], [ PM_DATA.name , PM_DATA ], [ CMEM.name , CMEM ], [ SR_0.name , SR_0 ], ], codeMemory: "EXT_CODE", dataMemory: "EXT_DATA", stackMemory: "EXT_DATA", l1DMode: "32k", l1PMode: "32k", l2Mode: "128k" };
2、然后在程序中定义了以下变量和其他测试代码:
#pragma DATA_SECTION(".noCache")INT32 testA[1024*8];
#pragma DATA_SECTION(".noCache")INT32 testB[1024*8];
3、在cfg文件中增加了以下代码:
Cache.setMarMeta(0x9A000000, 0x01000000, Cache.WTE );//DSP1 no cache
Program.sectMap[".noCache"] = "EXT_NOCACHE";
4、在rsc_table_vayu_dsp.cpp文件相应位置增加内存块定义
#define DSP_MEM_NOCACHE 0x9A000000#define DSP_MEM_NOCACHE_SIZE 0x01000000
{//no cache TYPE_DEVMEM, DSP_MEM_NOCACHE, DSP_MEM_NOCACHE, DSP_MEM_NOCACHE_SIZE, 0, 0, "DSP_MEM_NOCACHE", },
5、最后程序编译后map文件有如下相关信息:
MEMORY CONFIGURATION
name origin length used unused attr fill———————- ——– ——— ——– ——– —- ——– L2SRAM 00800000 00020000 00000b1c 0001f4e4 RW X 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 000ace7c 00753184 RW X EXT_DATA 98500000 01800000 0107a124 00785edc RW EXT_HEAP 99d00000 00300000 00000000 00300000 RW EXT_NOCACHE 9a000000 01000000 00010000 00ff0000 RW
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members———- ———– ———- ———– —– ——-
9a000000 9a000000 00010000 00000000 rw- 9a000000 9a000000 00010000 00000000 rw- .noCache
SECTION ALLOCATION MAP
output attributes/section page origin length input sections——– —- ———- ———- —————-
.noCache 0 9a000000 00010000 UNINITIALIZED 9a000000 00010000 DigPktFn.obj (.noCache)
LINKER GENERATED COPY TABLES
__TI_cinit_table @ 9957a100 records: 8, size/record: 8, table size: 64 .fardata: load addr=99577ef8, load size=00002059 bytes, run addr=9950cf00, run size=00053b92 bytes, compression=rle .fardata:IQexpTableMinMax: load addr=99579f54, load size=000000f5 bytes, run addr=00800a08, run size=000000f0 bytes, compression=rle .neardata: load addr=9957a04c, load size=00000057 bytes, run addr=99577b48, run size=0000018c bytes, compression=rle .fardata:IQexpTableCoeff: load addr=9957a0a4, load size=0000002e bytes, run addr=00800af8, run size=00000028 bytes, compression=rle .bss: load addr=9957a0e0, load size=00000008 bytes, run addr=99577b08, run size=00000040 bytes, compression=zero_init .far: load addr=9957a0e8, load size=00000008 bytes, run addr=98500000, run size=0100cec0 bytes, compression=zero_init .noCache: load addr=9957a0f0, load size=00000008 bytes, run addr=9a000000, run size=00010000 bytes, compression=zero_init .tracebuf: load addr=9957a0f8, load size=00000008 bytes, run addr=9f000000, run size=00008004 bytes, compression=zero_init
6、结果程序在启动加载时出错无法启动,如下
[ 10.460058] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@97C00000[ 10.467902] remoteproc0: 40800000.dsp is available[ 10.474630] remoteproc0: Note: remoteproc is still under development and considered experimental.[ 10.484419] remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.[ 10.741321] remoteproc0: registered virtio0 (type 7)[ 10.779237] remoteproc0: powering up 40800000.dsp[ 10.807028] remoteproc0: Booting fw image dra7-dsp1-fw.xe66, size 11243876[ 10.820724] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0[ 10.826660] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0[ 10.862042] remoteproc0: bad phdr da 0x9a000000 mem 0x10000[ 10.867754] remoteproc0: Failed to load program segments: -22[ 10.873774] remoteproc0: failed to unmap 8388608/19922944[ 10.879384] remoteproc0: failed to unmap 25165824/0[ 10.884422] remoteproc0: failed to unmap 3145728/16777216[ 10.898511] remoteproc0: failed to unmap 104857600/1048576[ 10.923466] remoteproc0: rproc_boot() failed -22[ 10.935917] virtio_rpmsg_bus: probe of virtio0 failed with error -22
如果我把Program.sectMap[".noCache"] = "EXT_NOCACHE";用“//”注释掉,此时数据会被分配到L2SRAM段,数据的初始化代码(参考第5步红色部分,自动调整为L2SRAM数据段),此时程序是能正常启动的。这是为何?
,
Denny%20Yang99373:
dsp L1D/L1P只能当cache用 不能当RAM用
,
Kevin Le82:
会不会是和这个问题一样:
e2e.ti.com/…/rtos-am5728-unable-to-boot-dsp-with-heap-in-l1d-sram
点错确认答案了,实际是可以的,我使用的系统版本是
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按理说应该已经修正了这个问题才对
,
Kevin Le82:
如果不使用变量定义,使用data_section定位方式,直接使用指针方式如INT32* testA=(INT32*)0x9A000100,是可以使用的;但是这样使用就需要很小心,不要有重叠出现,否则就很难查找问题所在了。