ldr r0, 0x12345678
That is, store the value at the address 0x12345678 into r0. However, mov cannot achieve this function. mov can only move data between registers, or move immediate values into registers. This is the biggest difference from CISC architecture chips such as x86. There is no such instruction as ldr in x86, because the mov instruction of x86 can move data from memory to registers. There is
also the ldr pseudo-instruction. Although the ldr pseudo-instruction is very similar to the ARM ldr instruction, its function is slightly different. The ldr pseudo-instruction can add = before the immediate value to indicate that a value (usually an address) is written to a register, for example:
ldr r0, =0x12345678
In this way, the value 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 number to 8 bits, which means it cannot exceed 512. The ldr pseudo-instruction does not have this limitation. If the ldr pseudo-instruction is used and the immediate number following it does not exceed 8 bits, then the ldr pseudo-instruction will be converted to a mov instruction during actual assembly. In fact, it is not accurate to say that the ldr instruction can load a 32-bit immediate number, because it is not actually this statement that loads a 32-bit immediate number. The real assembly code is to pass the value of a certain address to r1, which means that an address is needed to store the immediate number 0x12345678. And if this immediate number can be expressed in the form of a mov instruction, it will be actually replaced by mov by the compiler, for example:
will becomeldr r1,=0x10
mov r1,#0x10
In summary: The ldr pseudo-instruction is used to load a 32-bit immediate value or an address value into a specified register. When assembling a source program, the ldr pseudo-instruction is replaced by a suitable instruction by the compiler. If the loaded constant does not exceed the range of mov or mvn, the mov or mvn instruction is used to replace the ldr pseudo-instruction, otherwise the assembler puts the constant into a literal pool and uses a program-relative offset ldr instruction to read the constant from the literal pool. The ldr pseudo-instruction and the ldr instruction are not the same thing.
Previous article:Comparison of ARM and X86 architecture terminal features
Next article:How to use LDR in ARM
Recommended ReadingLatest update time:2024-11-16 16:48
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University----UCD3138 Analog Front End (AFE) Module
- "Show goods" to come to a wave of commonly used development boards
- Measurement of the phase difference between a sine wave and a square wave
- [Sipeed LicheeRV 86 Panel Review] - 6 waft-ui component tests (3)
- Code size after keil compilation
- Tips for removing chip components on PCB
- Hardware System Engineer's Handbook
- Integrated operational amplifier practical circuit diagram
- For electronic hardware, there are many circuit structures, which can be said to be the units that make up a component. All circuits...
- 【Ended】Microchip Live|Wireless Power Consortium (WPC) compliant wireless charging authentication