工作流在iPhone上编写ARM汇编code [英] Workflow for writing ARM assembly code on the iphone

查看:318
本文介绍了工作流在iPhone上编写ARM汇编code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始写ARM汇编并在iPhone上运行它。

I would like to begin writing ARM assembler and running it on the iPhone.

这是不是用在应用发布到应用商店的意图 - 基本上,我想利用来解决欧拉计划问题ARM和iPhone,只是为了爱好和教育目的。

This is not with the intent of using in an app to be released to the app store - Basically I would like to solve problems on ProjectEuler using ARM and the iPhone, just for hobby and educational purposes.

我怎么能去这样做?我一直没能想出一个办法让使用任何手写的胳膊项目正在运行。

How can I go about doing this? I have not been able to come up with a way get a project running using any hand written arm.

推荐答案

我一直没能找到有关如何为C专门编写汇编$ C $为iPhone的任何信息,但像其他人在这里说,你可以:

I haven't been able to find any information about how to write assembly code specifically for the iPhone, but like the other people said here, you can either:

1)用C / C ++ / ObjC code内联汇编语句,或者
2)编写独立汇编函数在一个'.S'文件,只是在你的X code源添加它,或
3)写外部独立汇编装配功能,如NASM。你写的'.S'文件汇编code和使用NASM生成一个的.o'目标文件和目标文件,在X code本项目联系起来。

1) write inline asm statements in C/C++/ObjC code, or 2) write standalone assembly functions in a '.s' file and simply add it in your XCode sources, or 3) write standalone assembly functions for an external assembler such as NASM. You write assembly code in a '.s' file and generate a '.o' object file using NASM and link the object file with your project in XCode.

所以,如果你只是想多写几个汇编指令,然后内联汇编将是最简单的方法,但如果你打算写几个汇编函数那么我建议一个独立的汇编文件。如果你打算与宏写许多装配功能,并希望跨平台兼容性,等等,那么我建议你使用NASM编译程序集code成目标文件。因为我使用的是X code GCC汇编器和它相比NASM相当缺乏。您可以在 http://www.nasm.us/

So if you are just trying to write a few assembly instructions then inline assembler would be the easiest way, but if you plan on writing several assembly functions then I'd recommend a standalone assembly file. And if you plan on writing many assembly functions with macros and want cross-platform compatibility, etc, then I'd recommend using NASM to compile your assembly code into an object file. Because I am using the XCode gcc assembler and it is quite lacking compared to NASM. You can get NASM for free at http://www.nasm.us/

一旦你设置你的汇编的环境,你需要学习如何编写ARM汇编code!由于iPhone(和许多其他便携设备和智能手机)使用ARM指令集。有一个非常好的,但老介绍到ARM汇编在 http://www.coranac.com/tonc/text/ asm.htm

Once you have setup your assembler environment, you need to learn how to write ARM Assembly code! Because the iPhone (and many other portable devices and smartphones) use the ARM instruction set. There is a very good but old intro to ARM assembly at http://www.coranac.com/tonc/text/asm.htm.

当涉及到汇编语言编程,官方指令集参考手册通常是一切信息,你会写的主要来源,所以你应该去ARM网站上下载的 ARM和Thumb-2快速参考卡(6页长),以及2个全证件您的CPU。

When it comes to assembly programming, the official instruction set reference manual is usually the main source of information for everything you will write, so you should go to the ARM website and download the ARM and Thumb-2 Quick Reference Card (6 pages long) as well as the 2 full documents for your exact CPU.

例如,iPhone 3GS和iPhone 4都具有一个用于ARMv7-A Cortex-A8的CPU,这样你就可以下载的 ARM体系结构参考手册ARMv7-A和ARMv7-R版(2000页长)的确切告诉您哪些指令可用,这也正是他们的工作,和的Cortex™-A8技术参考手册解释为特定的CPU指令时序等。

For example, the iPhone 3GS and iPhone 4 both have an ARMv7-A Cortex-A8 CPU, so you can download the ARM Architecture Reference Manual ARMv7-A and ARMv7-R Edition (2000 pages long) that tells you exactly which instructions are available and exactly how they work, and the Cortex™-A8 Technical Reference Manual that explains the instruction timing, etc for your specific CPU.

这篇关于工作流在iPhone上编写ARM汇编code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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