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.

TMS320F28379D: cpu调用ConfigCpuTimer工作不正常

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

环境:ccs12,最新,seedxds560v2plus仿真器

新板子,源代码原来是28m35和两个28335上长期使用的工程

最近想移植到28379上,

首先把代码全部移植到cpu1上,在cpu1 上代码可以跑,所有的外设驱动都写完并测试完毕,包括3个timer,pwm,can,spi,sci,uart,ecap,ad。。。

现在是想把代码分配到两个核,提高实时性,参考了C2000Ware_5_02_00_00\device_support\f2837xd\examples\dual\下边的代码。

具体是这样,我把代码分到两个核以后,cpu1可以跑,cpu2跑起来异常,

我尝试把cpu2所有的代码都屏蔽了,main()函数就剩下了timers的一个中断,主要代码在下边,其实就是把RAM_management_cpu02.c的代码精简后放这里了,其他的代码留在工程编译,但是没有任何调用,

//
// Main函数就剩下以下这么多
//
void main(void)
{

InitPieCtrl();

IER = 0x0000;
IFR = 0x0000;


InitPieVectTable();


EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TIMER0_INT = &cpu_timer0_isr;
EDIS; // This is needed to disable write to EALLOW protected registers


InitCpuTimers(); // For this example, only initialize the Cpu Timers

//
// Configure CPU-Timer0 to interrupt every second:
// c2_FREQ in MHz, 1 second Period (in uSeconds)
//
ConfigCpuTimer(&CpuTimer0, 200, 1000000);


CpuTimer0Regs.TCR.all = 0x4000;


IER |= M_INT1;


PieCtrlRegs.PIEIER1.bit.INTx7 = 1;


EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM

while(1)
{}
}

就这也不正常,time0中断不正常,单步执行代码到configCpuTimer(&CpuTimer0, 200, 1000000);这里的时候传进去的值不对,乱的

单步执行到以下部分的时候,

void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period)
{
Uint32 temp;

//
// Initialize timer period:
//
Timer->CPUFreqInMHz = Freq;
Timer->PeriodInUSec = Period;
这两个值都是野值。

然后把#pragma CODE_SECTION(cpu_timer0_isr,"isrfunc")屏蔽掉了,直接把中断函数放flash里边了,运行还是出错,一样野值

运行在flash模式,查了一下cmd文件,用的是2837xD_FLASH_lnk_cpu2.cmd,

.text               : > FLASHB      PAGE = 0, ALIGN(8)

text不够用,我做了两个尝试,

第一种,

.text               : > >FLASHB  | FLASHC    PAGE = 0, ALIGN(8)

代码可以放进去,但是运行时候还是上边的错误,值没有传进去,

我尝试把cmd里边的所有的FLASHB  替换成FLASHH,还是同样的错误

main函数里边基本是空了,就这几行有用的代码,还是出错

我又尝试把工程里边没调用的代码删除,最后代码小于FLASHB  这块空间了, cmd改回原始的2837xD_FLASH_lnk_cpu2.cmd,

再执行configCpuTimer(&CpuTimer0, 200, 1000000);这步执行就对了,

代码可以跑正确,但是我只要增加代码,text空间大于FLASHB  ,就怎么搞都不行了

这个问题把我搞晕了,不知道从哪里下手解决这个问题了,请高手帮忙提点一下!,

万分感谢!