没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
An Introduction to the GNU Assembler
The GNU Assembler, part of the GNU Tools software suite, is the assembler used in
the Digital Systems Laboratory to convert ARM assembly language source code into
binary object files. This assembler is extensively documented in the GNU Assembler
Manual (which can be found on your CD-ROM in the gnutools/doc directory). This
Introduction is a summary of that manual, specifically for the Laboratory.
Example and Template Files
The examples directory and its subdirectories on your CD-ROM contain many exam-
ples of assembly language programs that you can study. And you are encouraged to
do so! Please see the end of this document for more details.
One of the subdirectories in examples is templates. You are strongly encouraged to
use the files provided there as a starting point in writing your computer programs.
In particular, the file template.s should be used for all of your ARM assembly lan-
guage programming. This file, stripped of most of its comments, appears below:
.text ; Executable code follows
_start: .global _start ; "_start" is required by the linker
.global main ; "main" is our main program
b main ; Start running the main program
main: ; Entry to the function "main"
; Insert your code here
mov pc,lr ; Return to the caller
.end
Invoking the Assembler
You can assemble the contents of any ARM assembly language source file by exe-
cuting the arm-elf-as program. This can be invoked as:
arm-elf-as -marm7tdmi --gdwarf2 -o filename.o filename.s
Naturally, replace filename with whatever is appropriate for your project. The
command-line option -marm7tdmi instructs the GNU Assembler that your target CPU
is the ARM7TDMI (ARMv4T architecture). The option --gdwarf2 requests the as-
sembler to include information in the output file that is helpful for debugging—it
does not, incidentally, alter your program in any way. Chapters 1 and 2, as well as
section 8.4, of the GNU Assembler Reference list other command line options.
For larger projects, you should modularise your code into multiple source files. Each
source file (which has the extension .s) is then assembled using a command line
similar to the one shown.
Once you have assembled all of your source files into binary object files (with the
extension .o), you use the GNU Linker to create the final executable (extension .elf).
This is done by executing:
arm-elf-ld -o filename.elf filename.o
Once again, replace filename with whatever is appropriate for your project. If you
are using multiple source files (and hence multiple object files), replace filename.o
with a list of all object files in your project.
资源评论
- xiayu08132012-11-08很好,解决了燃眉之急!提供了移植windows下ARM汇编的途径
- weibo_test2012-06-18从xp下转学Linux的汇编,很受用
- jannl2013-12-27这个可以从arm官网上下到,类似的资料还有很多,不过实际用起来有偏差
- DaxusGu2013-01-22不错的资料,不过汇编学起来任重道远
- baiyudong22013-02-20还是不够全啊,求解救啊
比特人生
- 粉丝: 149
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功