您的位置:首页 > 其它

ARM处理器相关知识点总结

2012-08-20 01:17 267 查看
摘录自:ARM® Developer Suite Version 1.2 Assembler Guide

1、ARM processors always start executing code in ARM state.

2、ARM processors support up to seven processor modes, depending on the architecture version.

3、ARM processors have 37 registers.

4、By convention, r13 is used as a stack pointer(sp) in ARM assembly language. The C and C++ compilers always use r13 as the stack pointer.

5、In
User mode, r14 is used as a link register(lr) to store the return address when a subroutine call is made. It can also be used as a general-purpose register if the return

address is stored on the stack.

6、In the exception handling modes, r14 holds the return address for the exception, or a subroutine return address if subroutine callsare executed within an exception. r14 can be used as a general-purpose
register if the return address is stored on the stack.

7、The SPSRs are used to store the CPSR when an exception is taken.

8、Labels are symbols that represent addresses.The address given by a label is calculated during assembly.

9、The assembler calculates the address of a labelrelative to the origin of the section where the label is defined.A reference to a label within
the same section can use the program counter plus or minus anoffset. This is called program-relative addressing.

10、Addresses of labels in other sections are calculated at link time, when the linker has allocated specific locations in memory for each section.

11、Labels can be defined in a map. See Describing data structures with MAP and FIELD directiveson page 2-51. You can place the origin ofthe map in a specified register at runtime, and references to the label
use the specified register plus an offset. This is called
register-relative addressing.

12、BL destination

destinationis usually the label on the first instruction of the subroutine

The BLinstruction:

places the return address in the link register(lr)

sets pc to the address of the subroutine.

After the subroutine code is executed you can use a MOV pc,lrinstruction to return. By convention, registers r0 to r3 are used to pass parameters to subroutines, and to pass results
back to the callers.

13、You can include the C preprocessor command #include in your assembly language source file. If you do this, you must preprocess the file using the C preprocessor, before using armasmto assemble it.

armcpp -E < sourcefile.s > preprocessedfile.s

armasm preprocessedfile.s

14、

待续...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: