What is the difference between mov and ldr in arm instructions

Publisher:SparkStar22Latest update time:2016-05-11 Source: eefocusKeywords:mov  ldr Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
ARM is a RISC structure. The movement of data from memory to CPU can only be completed through L/S instructions, that is, ldr/str instructions. 
For example, if you want to read data from somewhere in memory to a register, you can only use ldr 
, such as: 
ldr r0, 0x12345678 
is to store the value at the address 0x12345678 in r0. 
However, mov cannot do this job. mov can only move data between registers, or move immediate values ​​to registers. This is the biggest difference from CISC architecture chips such as x86. 
There is no ldr instruction in x86, because the mov instruction of x86 can move data from memory to registers. 

There is also a ldr pseudo-instruction. Although the ldr pseudo-instruction is very similar to the ARM ldr instruction, the function is not quite the same. The ldr pseudo-instruction can add = before the immediate value to indicate that an address is written to a register, for example: 
ldr r0, =0x12345678 
, so the address 0x12345678 is written to r0. Therefore, the ldr pseudo-instruction is similar to mov. The only difference is that the mov instruction limits the length of the immediate value to 8 bits, that is, it cannot exceed 512. The ldr pseudo-instruction does not have this limitation. If the ldr pseudo-instruction is used and the immediate value following it does not exceed 8 bits, then the ldr pseudo-instruction will be converted to the mov instruction during the actual assembly. 

The ldr pseudo-instruction and the ldr instruction are not the same thing.
Keywords:mov  ldr Reference address:What is the difference between mov and ldr in arm instructions

Previous article:Difference between LDR instruction and LDR pseudo instruction
Next article:ARM immediate number explains the difference between LDR and MOV.

Recommended ReadingLatest update time:2024-11-23 06:28

ARM assembly LDR STR MOV
 ARM is a RISC structure. The movement of data from memory to CPU can only be completed through L/S instructions, that is, ldr/str instructions. For example, if you want to read data from somewhere in the memory into a register, you can only use ldr, such as: ldr r0, 0x12345678 is to store the value at the address 0x12
[Microcontroller]
The difference between LDR, LDM, STR and STM in assembly
(1) LDR: L stands for LOAD. The meaning of LOAD should be understood as: Load from memory into register. The following statement explains it very clearly: LDR      R1,          R1 - That is, read the value of the content of the storage unit pointed to by R2 (the value in a memory address) into R1 (a register)
[Microcontroller]
The difference between LDR and ADR in ARM assembly and its application in UBOOT
I saw the following code when looking at the lowlevel_init.S file of U-BOOT: lowlevel_init: ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON add r2, r0, #13*4 0: ldr r3, , #4 str r3, , # 4 cmp r2, r0 bne 0b mov pc, lr This code implements the register initialization of the memory control
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号