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.
用仿真器调试,M3工程和C28工程都可以正常运行,分别进入while(1);和for(;;);循环,执行相应的中断或者其他的代码。不带仿真器上电自运行,M3正常运行,C28初始化过程中运行到 InitAdc1(); 没有向下执行,用GPIO输出作为运行位置的标志,具体定位到DELAY_US(ADC_usDELAY),之前的代码被执行,之后的代码没有执行,如果屏蔽这个DELAY_US()函数,可以正常一直执行下去。这个函数用的TI的例程,没有修改。程序中添加了
#ifdef _FLASH
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash();
#endif
并且预定义“_FLASH”保证上面代码可以被执行。用仿真器全速运行和单步运行都可以顺利执行DELAY_US()。
请TI的工程师或者各位高手不吝赐教,不胜感激
多谢你的回复,
DELAY_US()函数定义如下
.def _DSP28x_usDelay
.sect "ramfuncs"
.global __DSP28x_usDelay
_DSP28x_usDelay:
SUB ACC,#1
BF _DSP28x_usDelay,GEQ ;; Loop if ACC >= 0
LRETR
其中.sect "ramfuncs"定义了代码段在 "ramfuncs"。在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_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0
初始化过程中先执行
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
在中间执行一些其他代码后才执行 DELAY_US()。我认为这样DELAY_US()算是在RAM中执行吧,不知道我的理解是否有误,请指教。