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.
请教各位前辈,以f28027的pwm为例程,将f28035的主程序替换掉f28027的main文件。然后添加一些f28035的头文件,发现memcopy报错:
Description Resource Path Location Type
declaration is incompatible with "Uint16 RamfuncsLoadEnd" (declared at line 89 of "D:\software\Ticcs\ticontrolSUITE\controlSUITE\device_support\f2802x\v125\DSP2802x_common\include\DSP2802x_GlobalPrototypes.h") HVPM_Sensorless.c /TripPWM line 63 C/C++ Problem
之前遇到main文件无法识别头文件内定义的参数,后来发现原来的f28035头文件有if(Device28035_H==1)这样类似的语句。。。现在好奇是不是没有识别cmd内的程序?
主程序内:
#ifdef FLASH
#pragma CODE_SECTION(MainISR,"ramfuncs");
#pragma CODE_SECTION(OffsetISR,"ramfuncs");
#endif
extern Uint16 *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
cmd文件:
ramfuncs : LOAD = FLASHD,
RUN = progRAM,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
DevInit_F2802x.c中函数定义:
void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
{
while(SourceAddr < SourceEndAddr)
{
*DestAddr++ = *SourceAddr++;
}
return;
}
谢谢您的回答,我是三个变量都报错,上面只贴了一条报错信息!在DSP2802x_GlobalPrototypes和DSP2803x_GlobalPrototypes中都是如此定义:
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
在HVPM_Sensorless.c却是定义
extern Uint16 *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;这在f28035中可运行,在f28027中报错。
所以我把它改成extern Uint16 RamfuncsLoadStart, RamfuncsLoadEnd, RamfuncsRunStart;就可以在f28027和f28035中都能编译。
总之这一块我感觉有点乱,看了好多网友的讲解,都觉得定义数据类型指向不明。。。希望能得到您的指教:
比如:ramfuncsloadstart是一个变量,对应的是起始地址。。。可是memCopy(&ramfunsloadstart,...)中却给的是ramfuncsloadstart这个变量的地址。那对应到:
void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
{
while(SourceAddr < SourceEndAddr)
{
*DestAddr++ = *SourceAddr++;
}
return;
}
等于 *SourceAddr==&ramfunsloadstart?明显不匹配啊
sourceAddr应该等于ramfuncsloadstart本身啊
请求您的帮助!
把现在里面的ramfunc都屏蔽了吧,用下面的写法:
// These are defined by the linker
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadSize;
extern Uint16 RamfuncsRunStart;
memcpy((uint16_t *)&RamfuncsRunStart,(uint16_t *)&RamfuncsLoadStart, (unsigned long)&RamfuncsLoadSize);
参考例程:
C:\ti\controlSUITE\device_support\f2803x\v130\DSP2803x_examples_ccsv5\flash_f28035
memcpy是编译器自带的函数。
ERIC