Tool/software: Code Composer Studio
I'm new to ccs. i tried executing circular convolution.
This is the program.
#include<stdio.h>
int m,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],a[30];
void main()
{
printf("Enter the length of the first sequence\n");
scanf("%d",&m);
printf("Enter the length of the second sequence\n");
scanf("%d",&n);
printf("Enter the first sequence\n");
for(i=0;i<m;i++)
{
scanf("%d",&x[i]);
}
printf("Enter the second sequence\n");
for(j=0;j<n;j++)
{
scanf("%d",&h[j]);
}
if((m-n)!=0)
{
if(m>n)
{
for(i=n;i<m;i++)
h[i]=0;
n=m;
}
for(i=m;i<n;i++)
x[i]=0;
m=n;
}
y[0]=0;
a[0]=h[0];
for(j=1;j<n;j++)
a[j]=h[n-j];
}
for(i=0;i<n;i++)
y[0]+=x[i]*a[i];
for(k=1;k<n;k++)
{
y[k]=0; /*circular shift*/
for(j=1;j<n;j++)
x2[j]=a[j-1];
}
x2[0]=a[n-1];
for(i=0;i<n;i++)
{
a[i]=x2[i];
y[k]+=x[i]*x2[i];
}
}
printf("the circular convolution is\n");
for(i=0;i<n;i++)
printf("%d\t",y[i]);
}
i got an an error , #171 expected a declaration
along with two others.
here is the console
**** Build of configuration Debug for project cir_conv ****
"E:\\CCS\\ccsv7\\utils\\bin\\gmake" -k -j 2 all -O
'Building file: "../main.c"'
'Invoking: C6000 Compiler'
"E:/CCS/ccsv7/tools/compiler/ti-cgt-c6000_8.2.2/bin/cl6x" -mv6740 --include_path="C:/Users/DSP/workspace_v7/cir_conv" --include_path="E:/CCS/ccsv7/tools/compiler/ti-cgt-c6000_8.2.2/include" --define=c6748 -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
>> Compilation failure
subdir_rules.mk:9: recipe for target 'main.obj' failed
"../main.c", line 40: error #171: expected a declaration
"../main.c", line 42: error #171: expected a declaration
"../main.c", line 49: warning #12-D: parsing restarts here after previous syntax error
"../main.c", line 50: error #171: expected a declaration
"../main.c", line 56: warning #12-D: parsing restarts here after previous syntax error
"../main.c", line 57: error #171: expected a declaration
"../main.c", line 59: error #171: expected a declaration
5 errors detected in the compilation of "../main.c".
gmake: *** [main.obj] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****
Any suggestions are highly appreciated.
Thank you.