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.

请教一下cmd文件的写法。



我在为dm8168的dsp核写算法,现在用模拟器跑出的时间和板子上真实的时间相差较大。有一个怀疑是模拟器使用了l2ram,而板子上没有用l2ram。因此在测试工程的cmd文件里这样写:

MEMORY
{
DSPL2ROM o = 0x00700000 l = 0x00100000 /* 1MB L2 Internal ROM */
DSPL2RAM o = 0x00800000 l = 0x00040000 /* 256kB L2 Internal RAM */
DSPL1PRAM o = 0x00E00000 l = 0x00008000 /* 32kB L1 Internal Program RAM */
DSPL1DRAM o = 0x00F00000 l = 0x00008000 /* 32kB L1 Internal Data RAM */
。。。

DDR o = 0x80000000 l = 0x80000000 /* 2GB DDR2 Data */
}

SECTIONS
{
.text > DDR
.stack > DDR
.bss > DDR
.cio > DDR
.const > DDR
.data > DDR
.switch > DDR
.sysmem > DDR
.far > DDR
.args > DDR
.ppinfo > DDR
.ppdata > DDR

/* COFF sections */
.pinit > DDR
.cinit > DDR

/* EABI sections */
.binit > DDR
.init_array > DDR
.neardata > DDR
.fardata > DDR
.rodata > DDR
.c6xabi.exidx > DDR
.c6xabi.extab > DDR

.testSect > DSPL2RAM
}

在代码里写:

char memForAlg[20*1024*1024];
unsigned char originalFrame[15*352*288*3/2];
unsigned char binaryFrame[15*352*288*3/2];

。。。

char memNoUse[256*1024];
#pragma DATA_SECTION(memNoUse, ".testSect");

编译的时候输出2个警告:

warning #10247-D: creating output section ".testSect" without a SECTIONS specification
warning #10281-D: Section ".bss" requires a STATIC_BASE relative relocation, but is located at 0xc228cb60, which is probably out of range of the STATIC_BASE. STATIC_BASE is located at 0xc2274948. Might be required to correct placement of ".bss" so it lies within 0x8000 of the STATIC_BASE

运行的时候得到几个数组的地址如下:

binaryFrame=0xC162CE00,

originalFrame=0xC1400000,

memForAlg=0x00700000,

memNoUse=0x00000000

显然memForAlg没有分配在片外,而memNoUse也没有分配在L2ram。我应该怎么写cmd文件?谢谢。

  • 今早意外的发现工程左边的文件列表上这个cmd文件被打了一个斜杠,然后我把它删了,再重新拷贝进来,就又对了。地址打印如下,看来l2ram被memNoUse数组占用了。但是,统计出的cycles数还是一样的,这说明模拟器的统计不受cache配置的影响。

    binaryFrame=0xC022CE00, originalFrame=0xC0000000, memForAlg=0xC0459C90, memNoUse=0x00800000

  • 去掉了memNoUse对DSPL2RAM的占用,打印如下。发现l2ram确实没人用,但是处理时间也没有因此提高。看来模拟器似乎不考虑内存的延迟,只统计指令周期数。

    binaryFrame=0xC022CE00, originalFrame=0xC0000000, memForAlg=0xC0459C90, memNoUse=0xC1859C90