在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 2437|回复: 1

指令中#与=有什么区别(内详)

[复制链接]
发表于 2003-11-27 15:50:49 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
请问如下程序段中#是立即寻址,那=是什么寻址方式?与#有区别吗?
AREAboot, CODE, READONLY
VECTORSEQU0x0c000000
ENTRY
movpc, #VECTORS
ldrpc, =VECTORS+4
ldrpc, =VECTORS+8
ldrpc, =VECTORS+0x0c
ldrpc, =VECTORS+0x10
ldrpc, =VECTORS+0x14
ldrpc, =VECTORS+0x18
ldrpc, =VECTORS+0x1c
END
 楼主| 发表于 2003-11-28 12:12:32 | 显示全部楼层

指令中#与=有什么区别(内详)

ADS的帮助文档里的解释:
4.9.3  LDR ARM pseudo-instruction
Load a register with either:
  a 32-bit constant value
  an address.
Note
This section describes the LDR pseudo-instruction only. See ARM memory access instructions for
information on the LDR instruction.
Syntax
LDR{cond} register,=[expr | label-expr]
where:
cond
is an optional condition code.
register
is the register to be loaded.
expr
evaluates to a numeric constant:
  the assembler generates a MOV or MVN instruction, if the value of expr is within range
  if the value of expr is not within range of a MOV or MVN instruction, the assembler places the
constant in a literal pool and generates a program-relative LDR instruction that reads the
constant from the literal pool.
label-expr
is a program-relative or external expression. The assembler places the value of label-expr in a
literal pool and generates a program-relative LDR instruction that loads the value from the
literal pool.
If label-expr is an external expression, or is not contained in the current section, the
assembler places a linker relocation directive in the object file. The linker generates the
address at link time.
Usage
The LDR pseudo-instruction is used for two main purposes:
  To generate literal constants when an immediate value cannot be moved into a register because
it is out of range of the MOV and MVN instructions
  To load a program-relative or external address into a register. The address remains valid
regardless of where the linker places the ELF section containing the LDR.
Note
  An address loaded in this way is fixed at link time, so the code is not position-independent.
The offset from the PC to the value in the literal pool must be less than 4KB. You are
responsible for ensuring that there is a literal pool within range. See LTORG for more
information.
See Loading constants into registers for a more detailed explanation of how to use LDR, and for
more information on MOV and MVN.
Example
        LDR     r3,=0xff0    ; loads 0xff0 into r3
                             ; =>  MOV r3,#0xff0
        LDR     r1,=0xfff    ; loads 0xfff into r1
                             ; =>  LDR r1,[pc,offset_to_litpool]
                             ;     ...
                             ;     litpool DCD 0xfff
        LDR     r2,=place    ; loads the address of
                             ; place into r2
                             ; =>  LDR r2,[pc,offset_to_litpool]
                             ;     ...
                             ;     litpool DCD place
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条


小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-1-21 05:00 , Processed in 0.023512 second(s), 23 queries , Gzip On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表