Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling a Linux program for ARM architecture - running on a host OS

Tags:

linux

windows

arm

I have a ARM Coretex-A8 development board from Freescale (i.MX53) running Linux Ubuntu. It boots up just fine and I can access the system with mouse/keyboard/terminal.

To get started I would like to make an application running on the board inside the host OS, just as you do when you run application on your PC.

My problem is to compile my test program, using toolchains like YAGARTO which is based on gcc i end up in trouble with the linking bacause I have not defined any startup script.

I find lot of information on building "bare metal" configurations (inluding compiling the kernel and make load and link scripts), but not anything usefull for making a application running on a host OS.

My development environment is running on Windows 7. I also have the option to run on Linux X86, but i doubt this whould help me making ARM applications.

like image 877
Christian Eggertsen Avatar asked Jan 28 '13 15:01

Christian Eggertsen


People also ask

Can ARM architecture be in Linux operating system?

ARM architectures have long used Linux operating systems (notably in devices like Raspberry Pi boards and smartphones from Samsung and Apple).

Which of the ARM architecture is support Linux?

ARM contributes support for ARM Versatile Express development platforms and ARM Development Studio 5 (DS-5) to the main Linux kernel.

Can I compile x86 to ARM?

No. Its because cross compiler(including clang) can generate binaries from host gcc for a target. There is no compiler which can generate x86 instructions from arm. You make no sense, compilation has nothing to do with host architecture.


1 Answers

For ARM-Linux application development the preferable choice is a Linux Host(x86) machine with a ARM toolchain installed in it. In Ubuntu Desktop machine you can use the following command to install ARM toolchain:

apt-get install gcc-arm-linux-gnueabi

After toolchain installation you can use the following command for cross compilation:

gcc-arm-linux-gnueabi-gcc -o hello hello.c

Using this toolchain you can cross-compile your C program using Standard C library without the need of startup code. Applications can be cross-compiled at your Host Linux(x86) platform and run on Target Linux(ARM) platform.

Windows version of ARM-Linux Toolchain is also available. You can get it from here.

Linaro Developers Wiki - an open organization focused on improving Linux on ARM, will be a good reference for your work.

like image 196
Praveen Felix Avatar answered Oct 03 '22 02:10

Praveen Felix