Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
04-09-2013, 05:09 AM
#1
Member
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445
Rep:
compiling hello world C program for arm ARM926EJ-S rev 5 (v5l) with arm-linux-gnueabi
I would like to compile a simple hello world example for my arm board I have its toolchain which works great but I want to compile my hello world with general arm-linux-gnueabi-gcc package of ubuntu but I had no success on it I have this error on my board:
Quote:
-sh: ./hello: cannot execute binary file
these are my informations which may help you to help me:
Quote:
cat /proc/cpuinfo
Processor : ARM926EJ-S rev 5 (v5l)
BogoMIPS : 197.83
Features : swp half fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant : 0x0
CPU part : 0x926
CPU revision : 5
compiling with general arm-linux-gnueabi-gcc of ubuntu:
Quote:
$ arm-linux-gnueabi-gcc -Q -v -mfloat-abi=soft -mcpu=arm926ej-s hello.c -o hello
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.6.3 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
COLLECT_GCC_OPTIONS='-Q' '-v' '-mfloat-abi=soft' '-mcpu=arm926ej-s' '-o' 'hello' '-mfpu=vfpv3-d16' '-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.6/cc1 -v -imultilib . -imultiarch arm-linux-gnueabi hello.c -dumpbase hello.c -mfloat-abi=soft -mcpu=arm926ej-s -mfpu=vfpv3-d16 -mthumb -auxbase hello -version -fstack-protector -o /tmp/ccU56dCs.s
GNU C (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (arm-linux-gnueabi)
compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/include"
ignoring nonexistent directory "/usr/include/arm-linux-gnueabi"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/arm-linux-gnueabi/4.6/include
/usr/lib/gcc/arm-linux-gnueabi/4.6/include-fixed
/usr/arm-linux-gnueabi/include
/usr/include
End of search list.
GNU C (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (arm-linux-gnueabi)
compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -v -imultilib . -imultiarch arm-linux-gnueabi hello.c
-mfloat-abi=soft -mcpu=arm926ej-s -mfpu=vfpv3-d16 -mthumb
-fstack-protector
options enabled: -fauto-inc-dec -fbranch-count-reg -fcommon
-fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
-feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident
-finline-functions-called-once -fira-share-save-slots
-fira-share-spill-slots -fivopts -fkeep-static-consts -fleading-underscore
-fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpeephole
-fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic
-fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock
-fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec
-fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column
-fsigned-zeros -fsplit-ivs-in-unroller -fstack-protector
-fstrict-volatile-bitfields -ftrapping-math -ftree-cselim -ftree-forwprop
-ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon
-ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pta
-ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize
-ftree-vect-loop-version -funit-at-a-time -fvar-tracking
-fvar-tracking-assignments -fzero-initialized-in-bss -mglibc
-mlittle-endian -msched-prolog -mthumb -mvectorize-with-neon-quad
Compiler executable checksum: c2a3eee802c1f4bc82a4d015bd8c8d6f
main
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <early_local_cleanups> <whole-program> <inline>Assembling functions:
main
Execution times (seconds)
parser : 0.01 (100%) usr 0.00 ( 0%) sys 0.01 (50%) wall 282 kB (21%) ggc
TOTAL : 0.01 0.00 0.02 1313 kB
COLLECT_GCC_OPTIONS='-Q' '-v' '-mfloat-abi=soft' '-mcpu=arm926ej-s' '-o' 'hello' '-mfpu=vfpv3-d16' '-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/as -mcpu=arm926ej-s -mfloat-abi=soft -mfpu=vfpv3-d16 -meabi=5 -o /tmp/ccY0ERq5.o /tmp/ccU56dCs.s
COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.6/:/usr/lib/gcc/arm-linux-gnueabi/4.6/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.6/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.6/:/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib/:/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/
COLLECT_GCC_OPTIONS='-Q' '-v' '-mfloat-abi=soft' '-mcpu=arm926ej-s' '-o' 'hello' '-mfpu=vfpv3-d16' '-mthumb'
/usr/lib/gcc/arm-linux-gnueabi/4.6/collect2 --build-id --no-add-needed --as-needed --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X --hash-style=gnu -m armelf_linux_eabi -z relro -o hello /usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib/crt1.o /usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib/crti.o /usr/lib/gcc/arm-linux-gnueabi/4.6/crtbegin.o -L/usr/lib/gcc/arm-linux-gnueabi/4.6 -L/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib -L/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib -L/lib/arm-linux-gnueabi -L/usr/lib/arm-linux-gnueabi -L/usr/lib -L/lib /tmp/ccY0ERq5.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/arm-linux-gnueabi/4.6/crtend.o /usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib/crtn.o
$ readelf -A hello
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_CPU_unaligned_access: v6
Tag_DIV_use: Not allowed
then scp hello binary file to arm board:
Quote:
# ./hello
-sh: ./hello: cannot execute binary file
compiling with arm-linux-gnueabi-gcc which is my arm board toolchain:
Quote:
/home/al/art/usr/local/arm-linux-gnueabi-gcc hello.c -o hello -Q -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: /home/ace.yang/toolchain/cross/targets/src/gcc-4.3.3/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabi --prefix=/usr/local/ --with-sysroot=/usr/local//arm-linux-gnueabi//sys-root --enable-languages=c,c++,fortran,java --disable-multilib --with-float=soft --with-pkgversion=Artila-crosstool --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/home/ace.yang/toolchain/cross/targets/arm-linux-gnueabi/build/static --with-mpfr=/home/ace.yang/toolchain/cross/targets/arm-linux-gnueabi/build/static --enable-threads=posix --enable-target-optspace --with-local-prefix=/usr/local//arm-linux-gnueabi//sys-root --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.3.3 (Artila-crosstool)
COLLECT_GCC_OPTIONS='-o' 'hello' '-Q' '-v' '-mfloat-abi=soft'
/home/ali/artila/usr/local/bin/../libexec/gcc/arm-linux-gnueabi/4.3.3/cc1 -v -iprefix /home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/ -isysroot /home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root hello.c -dumpbase hello.c -mfloat-abi=soft -auxbase hello -version -o /tmp/ccBxAq8b.s
ignoring nonexistent directory "/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/local//arm-linux-gnueabi//sys-root/include"
ignoring duplicate directory "/home/ali/artila/usr/local/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabi/4.3.3/include"
ignoring duplicate directory "/home/ali/artila/usr/local/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabi/4.3.3/include-fixed"
ignoring duplicate directory "/home/ali/artila/usr/local/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabi/4.3.3/../../../../arm-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/include
/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/include-fixed
/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/../../../../arm-linux-gnueabi/include
/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/include
End of search list.
GNU C (Artila-crosstool) version 4.3.3 (arm-linux-gnueabi)
compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-48), GMP version 4.3.2, MPFR version 3.0.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -v -iprefix
/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/
-isysroot /home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root
hello.c -mfloat-abi=soft
options enabled: -falign-loops -fargument-alias -fauto-inc-dec
-fbranch-count-reg -fcommon -fearly-inlining
-feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident -fivopts
-fkeep-static-consts -fleading-underscore -fmath-errno
-fmerge-debug-strings -fmove-loop-invariants -fpeephole
-freg-struct-return -fsched-interblock -fsched-spec
-fsched-stalled-insns-dep -fsigned-zeros -fsplit-ivs-in-unroller
-ftoplevel-reorder -ftrapping-math -ftree-cselim -ftree-loop-im
-ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops=
-ftree-reassoc -ftree-scev-cprop -ftree-vect-loop-version -fvar-tracking
-fzero-initialized-in-bss -mglibc -mlittle-endian -msched-prolog
-mthumb-interwork
Compiler executable checksum: c3bbbe8141d41807857b09ceff9e7a7e
main
Execution times (seconds)
preprocessing : 0.01 (100%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 74 kB (11%) ggc
parser : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 (100%) wall 138 kB (20%) ggc
TOTAL : 0.01 0.00 0.02 681 kB
COLLECT_GCC_OPTIONS='-o' 'hello' '-Q' '-v' '-mfloat-abi=soft'
/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/../../../../arm-linux-gnueabi/bin/as -mfloat-abi=soft -meabi=4 -o /tmp/cc2ocnTf.o /tmp/ccBxAq8b.s
COMPILER_PATH=/home/ali/artila/usr/local/bin/../libexec/gcc/arm-linux-gnueabi/4.3.3/:/home/ali/artila/usr/local/bin/../libexec/gcc/:/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/../../../../arm-linux-gnueabi/bin/
LIBRARY_PATH=/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/:/home/ali/artila/usr/local/bin/../lib/gcc/:/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/lib/:/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'hello' '-Q' '-v' '-mfloat-abi=soft'
/home/ali/artila/usr/local/bin/../libexec/gcc/arm-linux-gnueabi/4.3.3/collect2 --sysroot=/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o hello /home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/lib/crt1.o /home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/lib/crti.o /home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/crtbegin.o -L/home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3 -L/home/ali/artila/usr/local/bin/../lib/gcc -L/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/lib -L/home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/lib /tmp/cc2ocnTf.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/ali/artila/usr/local/bin/../lib/gcc/arm-linux-gnueabi/4.3.3/crtend.o /home/ali/artila/usr/local/bin/../arm-linux-gnueabi//sys-root/usr/lib/crtn.o
readelf -A hello
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "ARM9TDMI"
Tag_CPU_arch: v4T
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
then scp hello binary file to arm board:
I have to say I have tested all of arm9 parameter for mcpu and armv4 parameters for march but none of them worked.
I can see so many differences but I don't know how can I solve it
thanks for any help
04-10-2013, 02:14 PM
#2
Member
Registered: Nov 2005
Distribution: CentOS
Posts: 154
Rep:
Try:
add-apt-repository ppa:germia/archive3
apt-get update
apt-get install gcc-arm-none-eabi binutils-arm-none-eabi newlib-arm-none-eabi gdb-arm-none-eabi
Then compile with CROSS_COMPILE=arm-none-eabi-
04-23-2013, 10:30 AM
#3
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
There are so many variants of ARM CPUs and other elements: CPU version, ABI, Floating point support, endianness, etc, that not all toolchains for ARM are anything like equal. Your case is evidence of this. Since you evidently do have one working cross toolchain, I don't really see what the problem is.
--- rod.
All times are GMT -5. The time now is 12:22 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News