I am trying to generate assembly and executable of a simple neon-based c code. The code is,
#include <arm_neon.h>
void NeonTest(short int * __restrict a, short int * __restrict b, short int * __restrict z)
{
int i;
for (i = 0; i < 200; i++) {
z[i] = a[i] * b[i];
}
}
First, I am going for the assembly to calculate the neon instructions,
arm-linux-gnueabi-gcc -O2 -march=armv7-a -mtune=cortex-a9 -ftree-vectorize -mhard-float -mfloat-abi=softfp -mfpu=neon -S neon_test.c -o nt.s
Then I am converting the nt.s file to object file.
arm-linux-gnueabi-gcc -O2 -march=armv7-a -mtune=cortex-a9 -ftree-vectorize -mhard-float -mfloat-abi=softfp -mfpu=neon -c nt.s -o nt.o
Finally, for the executable I do,
arm-linux-gnueabi-gcc -O2 -march=armv7-a -mtune=cortex-a9 -ftree-vectorize -mhard-float -mfloat-abi=softfp -mfpu=neon nt.o -o nt
I get the error,
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/crt1.o: In function `_start':
(.text+0x34): undefined reference to `main'
collect2: error: ld returned 1 exit status
I am using Ubuntu 14LTS on Intel system.
Every program needs a starting point so the computer knows where to begin execution. In C/C++, the starting point is the beginning of the function int main
. Give your program an int main
by either linking your object file to an object file with int main
, or adding one in this code.
To add main in your code, beneath your function definition, try
int main()
{
NeonTest(/* your parameters */);
}