简体   繁体   中英

how to specify Cortex-A53 in arm-none-eabi-gcc?

I'm trying to compile a HELLOWORLD.c with arm-none-eabi-gcc in minGW, the command is like this:

D:\code>arm-none-eabi-gcc hello.c -o hello -shared

and it worked, and generates an "hello" which details info is like this:(I put it into Ubuntu and file it):

gec@ubuntu:/mnt/hgfs/code$ file hello
hello: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, not stripped

and then I put it into my target plat-form(Cortex-A53) and run, the result is:

[root@GEC6818:~]# ./a
Segmentation fault

and then, I notice that I should specify the CPU or architecture in the compile command, so I compile like this:

D:\code>arm-none-eabi-gcc hello.c -o a -mcpu=cortex-a53 --specs=nosys.specs

but it doesn't work, the run result is this:

[root@GEC6818:~]# ./a
Killed

so, can any body pls help me out?? thanks from the bottom of my heart

From the command-prompt visible in your post, it seems you are trying to execute your program on a Linux system:

[root@GEC6818:~]# ./a
Killed

If this is the case, you should not use an arm-none-eabi-gcc toolchain, which is targeting a baremetal (non-linux) target platform - see here for an explanation of the relationship between a gcc toolchain name and the system it is targeting.

More specifically, the --specs=nosys.specs option is supposed to be used when compiling for a system which is not running a general purpose operating system, ie Linux .

You should use one of arm-linux-gnueabihf or aarch64-linux-gnu instead. The first toolchain should be used if you are running a 32 bit ARM Linux, the second one if you are running a 64 bit Linux.

You can determine which version you are running using the file command on an executable available in your original ARM system, such as /bin/sh . If /bin/sh is an ELF 32-bit executable, use arm-linux-gnueabihf . If it is an ELF 64-bit executable, use aarch64-linux-gnu .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM