`#includefloatInput[2*Tn+4];floatCFFT_In[2*Tn+4];floatCFFT_InOrig[2*Tn+4];floatCFFT_InvOut[2*Tn+4];floatCTemp[2*Tn+4];floatCw[2*Tn];floatCmo[Tn+2];unsignedcharbrev[64]={0x0,0x20,0x10,0x30,0x8,0x28,0x18,0x38,0x4,0x24,0x14,0x34,0xc,0x2c,0x1c,0x3c,0x2,0x22,0x12,0x32,0xa,0x2a,0x1a,0x3a,0x6,0x26,0x16,0x36,0xe,0x2e,0x1e,0x3e,0x1,0x21,0x11,0x31,0x9,0x29,0x19,0x39,0x5,0x25,0x15,0x35,0xd,0x2d,0x1d,0x3d,0x3,0x2b,0x1b,0x3b,0xb,0x2b,0x1b,0x3b,0x7,0x2f,0x1f,0x3f,0xf,0x2f,0x1f,0x3f, };voidtw_gen(float*w,intn){inti,j,k;doubletheta1,theta2,theta3;for(j=1,k=0;j<=n>>2;j=j<<2){for(i=0;i<n>>2;i+=j){theta1=2*PI*i/n;w[k]=(float)cos(theta1);w[k+1]=(float)sin(theta1);theta2=4*PI*i/n;w[k+2]=(float)cos(theta2);w[k+3]=(float)sin(theta2);theta3=6*PI*i/n;w[k+4]=(float)cos(theta3);w[k+5]=(float)sin(theta3);k+=6;} } }voidFFTTest(){unsignedinti;for(i=0;iInput[i]=5*sin(2*PI*150*(i/Fs))+15*sin(2*PI*350*(i/Fs));unsignedcharrad;if(Tn==16||Tn==64||Tn==256||Tn==1024||Tn==4096||Tn==16384||Tn==65536)rad=4;elseif(Tn==8||Tn==32||Tn==128||Tn==512||Tn==2048||Tn==8192||Tn==32768)rad=2;else{printf("Tn的值不合适\n");return;}for(i=0;i<2*Tn;i++)CFFT_In[i]=0.0;for(i=0;ii++){CFFT_In[2*i]=Input[i];CFFT_In[2*i+1]=0;}memcpy(CFFT_InOrig,CFFT_In,2*Tn*sizeof(float));tw_gen(Cw,Tn);floatCFFT_Out[2*Tn];DSPF_sp_fftSPxSP(Tn,CFFT_In,Cw,CFFT_Out,brev,rad,0,Tn);for(i=0;i{Cmo[i]=sqrt(CFFT_Out[2*i]*CFFT_Out[2*i]+CFFT_Out[2*i+1]*CFFT_Out[2*i+1]);Cmo[i]=Cmo[i]*2/Tn;}memcpy(CTemp,CFFT_Out,2*Tn*sizeof(float));DSPF_sp_ifftSPxSP(Tn,CFFT_In,Cw,CFFT_Out,brev,rad,0,Tn);memcpy(CFFT_InvOut,CFFT_Out,2*Tn*sizeof(float));//输出检测结果printf("FFT输出检测:\n");unsignedcharFlag=0;for(i=0;ii++){if(fabs(CFFT_InOrig[i]-CFFT_InvOut[i])>F_TOL){Flag=1;break;} }if(Flag==1)printf("失败!\n");elseprintf("成功!\n");}intmain(){printf("FFT测试开始\n");FFTTest();printf("FFT测试完成\n");return0;}`
![6P}ZDVA(T9TA1_8H2(RX.png
调用过dsplib和mathlib库,只要运行到FFTTEST的函数 就会报错,不清楚是调用错误还是仿真不支持。 报错:Can't find a sourcefileat"/tmp/TI_MKLIB429RQi/SRC/boot.c"Locate thefileoreditthe sourcelookuppath toincludeits location. 控制台报错:TMS320C64X+_0:Error: Illegal opcode (40252766) at pc = 0x80014094 Illegal opcode at pc = 0x80014094 (TMS320C64X+_0:是默认名字,实际还是C6748的没有不匹配)