Other Parts Discussed in Thread: TMS320C6748
Hello,
I am trying to start off with DSPs(the TMS320C6748 to be exact and I am simulating it for now. The problem is that whenever I try to generate two sine waves each having 240 samples, I get the error:
TMS320C64X+_0: Error: Illegal opcode (00000754) at pc = 0x00000230 Illegal opcode at pc = 0x00000230
I dont get that, I have chosen the C647x as the Generic Device and the xC674x Connector for the simulator as my target configuration. My code is:
//Code:
// Calculates the Sine of an angle using its power series.
#include<math.h>
#include<stdio.h>
double fact(int); //Declares the function for calculating the factorial
float power(float,unsigned char); //Declares the function for calculating the power of a float
double sinm(double);
#define PI 3.1416 //Defines the constant PI
#define f 500 //Defines the frequency of the signal
#define fs 48000 //Defines the sampling frequency of the signal
void main(void)
{
double xn[240],b[240];
unsigned char i;
//printf("Enter an angle in radians(-pi/2 to pi/2) ");
//scanf("%lf",&angle); //Gets the value of the angle in radians to calculate the sine of
for(i=0;i<240;i++)
{
xn[i]=sinm(2*PI*f*i/fs);
b[i]=sinm(2*PI*f*i/fs);
}
while(1);
}
////Calculates the sine fo the angle with a precision of .00001
double sinm(double angle)
{
double sinx,cal_term;
unsigned char i=3,k=0;
while(angle>6.283)
angle=angle-6.283;
sinx=angle;
do
{
cal_term=(power(angle,i)/fact(i));//Calculates the (i+1)th term of the power series
if( k%2==0)sinx=sinx-cal_term;
else if(k%2==1) sinx=sinx+cal_term;
i=i+2;
k++;
}
while(cal_term>0.00001);
return(sinx);
}
double fact(int num) //Calculates the factorial of a number
{
unsigned char i;
double fact_ans=1;
int temp=num;
for(i=0;i<num;i++)
{
fact_ans=fact_ans*temp;
temp--;
}
return(fact_ans);
}
float power(float num,unsigned char power) //Calculates the power of a float
{
float result=1;
unsigned char j;
for(j=0;j<power;j++) result=result*num;
return(result);
}
My command file is:
/*************************************************************************
* linker.cmd for BIOS Workshop LAB 2A
**************************************************************************/
-stack 0x00000800
-heap 0x00008800
MEMORY
{
IRAM: ORIGIN = 0x11800000 LENGTH = 0x00040000
L3_shared_RAM: ORIGIN = 0x80000000 LENGTH = 0x00020000
DDR2_data: ORIGIN = 0xC0000000 LENGTH = 0x08000000
}
SECTIONS
{
.text > IRAM
.const > IRAM
.bss > IRAM
.far > IRAM
.switch > IRAM
.stack > IRAM
.data > IRAM
.cinit > IRAM
.sysmem > IRAM
.cio > IRAM
}
I would be very thankful if anyone of you can help me out. Thanks.