Visit The New, Modern Unix Linux Community


gcc for arm process


 
Thread Tools Search this Thread
Top Forums Programming gcc for arm process
# 1  
gcc for arm process

hi,

correct me if am wrong, as per gcc doc gcc is able to compile code for different target systems such as ARM, ARC etc. I tried for compiling ARM but failed to do so.
getting below error:

Code:
gcc -mcpu=arm920t -c avg.c -o agv_arm
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
avg.c:1: error: bad value (arm920t) for -mtune= switch

any idea or hint whats am doing wrong. Can you please explain compilation steps for different targets. I am using intel i386 machine with gcc 4.1.2

Thanks...
# 2  
It can't compile for different architectures unless you have a version configured to do so. For the 99% of people who don't need them, the code and headers to compile ARM, SPARC, MIPS, and other foreign binaries would be a pointless waste of space. When I tried developing for OpenWRT, their CVS repository installed it's own whole dedicated compiler!

Even if configured for ARM it probably won't be producing binaries quite the way you want them -- compile an ARM executable under linux and you'll get an ARM Linux executable, not one for a foreign OS, because you compiled it with linux headers...
# 3  
As Corona688 says, you need a special type of compiler for that.

What you wanna do is called "Cross compilation" for ARM platform, so you need the following tools, which are just a version of gcc that creates binaries for ARM.

If you're trying to compile a Linux kernel for an ARM platform, just use the variables ARCH and CROSS_COMPILE as follow:
Code:
root@box:~# make ARCH=arm CROSS_COMPILE=/path/to/arm-linux-

Where 'arm-linux-' are the tools from the link i just left you.

Last edited by Zykl0n-B; 09-08-2010 at 06:19 PM..
Zykl0n-B
# 4  
Hi,

I knew to do a cross compilation we need library supporting cross compiled libraries. There is arm-linux-gcc tool chain available for that and also this will gonna execute on the platform for which it is compiled.

To do make, we have to write Makefile ..


My question was simple, let me make it more simpler, GCC has got compilation for target options
i.e. mcpu, march, etc How can we use that to compile a C code for ARM, MSP or ARC processors?
Can anyone give me sample steps for compiling?

Thanks...
# 5  
Quote:
Originally Posted by zing_foru
My question was simple, let me make it more simpler, GCC has got compilation for target options
i.e. mcpu, march, etc How can we use that to compile a C code for ARM, MSP or ARC processors?
Can anyone give me sample steps for compiling?
We're not trying to withhold information from you. This isn't "easy".

Usually to build something you'd
  • Download it
  • Extract it
  • ./configure --help
  • ./configure
  • make
  • Attempt to install without overwriting any files from your good compiler(no sense having 2 broken compilers instead of 1 working one)
The ./configure step involves decisions on not just what architecture to use but where to keep headers, where to keep libraries, and how to use them. Usually these choices'd be made by the people managing your distribution. You may also need patches, again, usually provided by the people managing your distribution.

Last edited by Corona688; 09-13-2010 at 12:49 PM..
# 6  
Yeah thats simple with autoconf and then make...

what will we do if we have just a hello world program and want to cross-compile it for MSP or PPC board ... the mcpu and march when can I use these options? OR are these just to make more optimum binaries for the running platform itself?

Quote:
GCC has got compilation for target options
i.e. mcpu, march, etc How can we use that to compile a C code for ARM, MSP or ARC processors?
Can anyone give me sample steps for compiling?
# 7  
Quote:
Originally Posted by zing_foru
what will we do if we have just a hello world program and want to cross-compile it for MSP or PPC board ... the mcpu and march when can I use these options? OR are these just to make more optimum binaries for the running platform itself?
Are you talking about an MSP board running linux, or a standalone non-linux platform?

Last edited by Corona688; 09-20-2010 at 02:08 PM..

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #114
Difficulty: Easy
Linux was derived from the Unix design philosophy.
True or False?

9 More Discussions You Might Find Interesting

1. BSD

Move from Solaris: ARM 64 Bit

Hey all I've been thinking of switching my x86 Solaris out with ARM 64 Bit and FreeBSD. Now i know i can migrate my striped-mirror ZFS to FreeBSD. So to get to the point. I take advantage of Kernel Zones on Solaris (Routing, Firewall, Web Access and Web Page etc.) and from time to time need... (1 Reply)
Discussion started by: Reclzz
1 Replies

2. Programming

IDE's for the ARM processor on Linux

Hello everyone. I am running Debian on an ARM7 Device (aka my android phone). Everything is great. Works well. I would love to use it for Development. Mainly my interests are in Web Development, and Java development. So far the only useful IDE for debian arm is Netbeans. Which is pretty... (0 Replies)
Discussion started by: CDevelop
0 Replies

3. Programming

Running c code in ARM QEMU

I created and Compiled a C program to run in QEMU for ARM. When I run the program using the command #qemu-arm -L /home/arm-2010.09/arm-none-linux-gnueabi/libc ./test it gives me the following error: If 'qemu-arm' is not a typo you can use command-not-found to lookup the package that contains... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

4. Programming

Cygwin + insight + arm utils

Hello all, I have just installed cygwin and arm tools to do some arm assembly programming, but when i try to initialize insight with arm-elf-insight xxx.xxx I receive the message that arm-elf-insight cannot find cygncurses-8.dll. In my lib directory I have cygncurses-10.dll, but not... (0 Replies)
Discussion started by: Hiox
0 Replies

5. Fedora

gcc arm compiler

think only compile is required I wish to compile a sample code int main() { int a=5,b=8,c; c=a+b; } compile using gcc -Wall -g -march=arm922t main.c -o hello I got an error :bad value(arm922t) for -march=switch instead of using march i used mcpu options ,the same... (1 Reply)
Discussion started by: sujith4u87
1 Replies

6. UNIX for Advanced & Expert Users

gcc arm compiler

I want to find the ARM assembly language for my sample C code using gcc .I had gcc compiler ,whether it is enough for it or i need to download gcc arm cross compiler.If necessary ,how it configured?I am using fedora (0 Replies)
Discussion started by: sujith4u87
0 Replies

7. Programming

When a process is down - how to get a coredump in arm board?

Running a multi-threaded program in my arm board one day or more ,The process down . In order to get a coredump to analysis of the stack , . I use commands ulimited -c unlimited . but when the process down . no coredump But I write a test #include <stdio.h> int main(void){ ... (14 Replies)
Discussion started by: aobai
14 Replies

8. Linux

Kernel internals for ARM

Hi, Does anybody have a good pointer on Linux kernel internals for ARM architecture? I can locate plenty for x86 but since ARM is RISC I think there would be subtle changes. So if somebody has a knowledge of good document on Linux Kernel internals for ARM or even a comparative study of kernel on... (0 Replies)
Discussion started by: Rakesh Ranjan
0 Replies

9. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

Featured Tech Videos