Page 1 of 1

Message "Illegal Instruction".

Posted: Wed Jan 27, 2010 6:05 pm
by Klausenner
I made a program to generate prime numbers, but when I run the S3C2440 get "Illegal Instruction".
When I compile the same program to another platform it works perfectly. even in np ARM9.
Can anyone help me solve this?

Code: Select all

#include <stdio.h>
#include <stdlib.h>

unsigned char teste(int numero)
{
unsigned int metade=0;
unsigned int cont=2;
metade = (numero/2)+1;

for(cont=2;cont <= metade; cont++)
{
 if (numero%cont==0)
 {
	return 0;
	break;
 }

}
return 10;
}

 int main (int argc,char *argv[]){

unsigned  int cont1=5,numPri,inicio;

sscanf(argv[1],"%d",&numPri);

sscanf(argv[2],"%d",&inicio);
printf("calma");

 for(cont1=0;cont1 < numPri;) 
 {

if (teste(inicio))
	{
	printf("O numero %u\n",inicio);
	cont1++;
	}
inicio++;

}

}



Re: Message "Illegal Instruction".

Posted: Thu Jan 28, 2010 1:54 pm
by Sak1s
post any details......your gcc -v toolchain output

and its for linux ? or directly to cpu ?

Re: Message "Illegal Instruction".

Posted: Sat Jan 30, 2010 2:24 pm
by Klausenner
I solved the problem, I downloaded another compiler
Thank you.

http://www.andahammer.com/Downloads/Flo ... a02971f701