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.

如何知道某个函数在RAM中运行还是在FLASH中运行

Other Parts Discussed in Thread: TMS320F2808

本产品使用了TMS320F2808芯片,想要大部分代码在FLASH中运行,关键的几个c函数在RAM中运行以提高速度。关键代码如下。

main.c文件中相关代码如下:

/* These are defined by the linker (see F2808.cmd) */
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;

void main(void)
{

..........

MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);  // Copy time critical code and Flash setup code to RAM
InitFlash();  // Call Flash Initialization to setup flash waitstates,This function must reside in RAM

GpioDataRegs.GPASET.bit.GPIO2 = 1; // GPIO2=1
rfft(x,256);  // 25.6ms;
GpioDataRegs.GPACLEAR.bit.GPIO2 =1; // GPIO2=0

}

RealFFT.c文件中相关代码如下

#pragma CODE_SECTION(rfft, "ramfuncs");  // 去掉此行,测量到函数rfft的执行时间不变,为25.6ms

void rfft(float x,int n)

{

......

}

f2808.cmd文件中相关代码:

SECTIONS
{

/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0

......

请帮忙分析代码,是否rfft函数真的在RAM中执行?

有没有简单的方法知道某个c函数是在RAM中运行还是在FLASH中运行?