could someone please help me modify the below c program to work for AT91RM9200(ARM7TDMI)using keil simulation. the program is for finding dct coefficients for input pixel values #include<stdio.h> #include<conio.h> #include<math.h> #define N 8 void main() { int i,j,k,l; float f[10][10],fdct[10][10],a[10][10]; //input pixel values and output DCT coefficients clrscr(); /*printf("\n Enter the input pixel values:\n"); for(i=0;i<N;i=i+1) { for(j=0;j<N;j=j+1) { scanf("%f\n ",&f[i][j]); //Reading input pixel values given by user } } */ a[0][0]=23; a[0][1]=12; a[0][2]=14; a[0][3]=15; a[0][4]=30; a[0][5]=34; a[0][6]=10; a[0][7]=30;
a[1][0]=60; a[1][1]=70; a[1][2]=50; a[1][3]=70; a[1][4]=85; a[1][5]=90; a[1][6]=50; a[1][7]=94;
a[2][0]=54; a[2][1]=84; a[2][2]=30; a[2][3]=44; a[2][4]=50; a[2][5]=76; a[2][6]=80; a[2][7]=34;
a[3][0]=20; a[3][1]=22; a[3][2]=20; a[3][3]=33; a[3][4]=20; a[3][5]=93; a[3][6]=40; a[3][7]=58;
a[4][0]=43; a[4][1]=20; a[4][2]=10; a[4][3]=10; a[4][4]=40; a[4][5]=50; a[4][6]=60; a[4][7]=70;
a[5][0]=66; a[5][2]=60; a[5][3]=67; a[5][4]=60; a[5][5]=62; a[5][6]=70; a[5][7]=81;
a[6][0]=39; a[6][1]=35; a[6][2]=30; a[6][3]=38; a[6][4]=0; a[6][5]=34; a[6][6]=40; a[6][7]=42;
a[7][0]=60; a[7][1]=74 ; a[7][2]=70; a[7][3]=40; a[7][4]=35; a[7][5]=50; a[7][6]=40; a[7][7]=63;
a[8][0]=30; a[8][1]=40; a[8][2]=50; a[8][3]=42; a[8][4]=30; a[8][5]=21; a[8][6]=120; a[8][7]=230; for(i=0;i<N;i=i+1) { for(j=0;j<N;j=j+1) { f[i][j]=a[i][j]; } } for(i=0;i<N;i=i+1) { for(j=0;j<N;j=j+1) { printf("%f ",f[i][j]); } printf("\n"); } for(i=0;i<N;i=i+1) { for(j=0;j<N;j=j+1) { fdct[i][j]=0; for(k=0;k<N;k=k+1) { for(l=0;l<N;l=l+1) { if(i==0&&j==0) fdct[i][j]= fdct[i][j]+(1/4)*(1/2)*f[k][l]*cos((2*k+1)*i*3.14/16)*cos((2*l+1)*j*3.14/16); /*printf("%f ",fdct[i][j]); printf("%f ",(1/4)*(1/2)*f[k][l]); printf("%f ",f[k][l]); printf("%f ",cos((2*k+1)*i*3.14/16));*/ if(i==0&&j!=0) fdct[i][j]= fdct[i][j]+(1/sqrt(2))*(1/4)*f[k][l]*cos((2*k+1)*i*3.14/16)*cos((2*l+1)*j*3.14/16); if(i!=0&&j==0) fdct[i][j]= fdct[i][j]+(1/4)*(1/sqrt(2))*f[k][l]*cos((2*k+1)*i*3.14/16)*cos((2*l+1)*j*3.14/16); if(i!=0&&j!=0) fdct[i][j]= fdct[i][j]+(1/4)*f[k][l]*cos((2*k+1)*i*3.14/16)*cos((2*l+1)*j*3.14/16); } } } }
printf("\n"); printf("\n"); for(i=0;i<N;i=i+1) { for(j=0;j<N;j=j+1) { printf("%f ",fdct[i][j]); } printf("\n"); }
getch(); }
If I remember correctly, the Keil tools will count both code and data when deciding the max size possible for the evaluation version. But you can change arrays to pointers and then assign values to these pointers when the program starts.
But I didn't see any large arrays in your code. Just three arrays of 400 bytes each. It is probably the need of floating point emulation that makes you fail the limit of the evaluation version.
The ARM processor AT91RM9200 is a 32 bit processor. It is compatible for a floating point operation. Could u suggest any other processor which is better suited for the program