I want to compile some code to run on an embedded Linux w/ MIPS arch. But I can't get my MIPS cross compiler (mips-linux-gnu-gcc) to compile my hello-world file correctly. I mean, it is compiling without errors. It just doesn't run on my embedded device.
I downloaded a sample executable from the device (which is proved to be running correctly obviously) and running file this is the output I get:
ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked, interpreter /lib/ld-, stripped
But when I compile my code with
mips-linux-gnu-gcc main.c
file's result on my compiled file is:
ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld., for GNU/Linux 3.2.0, BuildID[sha1]=..., not stripped
I've tried adding -mips1 -mfp32 to the compilation command but still the output isn't what I want:
ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld., for GNU/Linux 3.2.0, BuildID[sha1]=..., not stripped
What flags do I need to use for the compiler to compile my program correctly? Or do I need a completely different compiler? I suspect it's only flags but I don't know which. I suspect that the problem is that I get MIPS32 instead of MIPS-I.