为 ARM 架构编译 Linux 程序 - 在主机操作系统上运行 [英] Compiling a Linux program for ARM architecture - running on a host OS

查看:31
本文介绍了为 ARM 架构编译 Linux 程序 - 在主机操作系统上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个飞思卡尔 (i.MX53) 的 ARM Coretex-A8 开发板,运行 Linux Ubuntu.它启动得很好,我可以用鼠标/键盘/终端访问系统.

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.

首先,我想让一个应用程序在主机操作系统内的板上运行,就像您在 PC 上运行应用程序一样.

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.

我的问题是编译我的测试程序,使用像 YAGARTO 这样基于 gcc 的工具链,我最终遇到了链接问题,因为我没有定义任何启动脚本.

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.

我的开发环境在 Windows 7 上运行.我也可以选择在 Linux X86 上运行,但我怀疑这是否有助于我制作 ARM 应用程序.

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.

推荐答案

对于 ARM-Linux 应用程序开发,最好的选择是安装了 ARM 工具链的 Linux Host(x86) 机器.在 Ubuntu 桌面机器中,您可以使用以下命令安装 ARM 工具链:

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

使用此工具链,您可以使用标准 C 库交叉编译您的 C 程序,而无需启动代码.应用程序可以在您的 Host Linux(x86) 平台上交叉编译并在 Target Linux(ARM) 平台上运行.

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 版本的 ARM-Linux 工具链也可用.您可以从此处获取.

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

Linaro Developers Wiki - 一个专注于改进 Linux on ARM 的开放组织,将为您的工作提供很好的参考.

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

这篇关于为 ARM 架构编译 Linux 程序 - 在主机操作系统上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆