- The B jump instruction is independent of the code position. After assembly, it will be replaced by the current PC value plus (minus) a correction value. No matter which address this instruction is executed at, it can jump to the specified location.
- B can only jump within the 32M range of the current PC, and LDR can only jump within the 4KB (0xfff range) of the current PC.
- The LDR PC, =xxx instruction will directly load the value of a label xxx into PC, but the label will be replaced with a value corresponding to RO after compilation, so that it can jump to a specified location no matter where the instruction is executed.
- Take the startup code snippet of AT91SAM9260 as an example, 0x10000000 is the Flash base address, and 0x20000000 is the SDRAM base address:
ENTRY is the starting point, which means the offset of this code is 0. Let HandlerReset's offset be offset. If this program is compiled according to RO=0x10000000:
b HandlerReset <=> ADD PC, PC, #offset
LDR PC, =HandlerReset <=> MOV PC, #(RO+offset)
When the system is reset, b HandlerReset points PC to the location of the Flash image code at address 0; while LDR PC, =HandlerReset points PC to the original code location in Flash, so both can execute normally.
However, if the program is compiled according to RO=0x20000000, the code generated after compilation still needs to be burned into Flash, that is, address 0x10000000. After the system is reset, it will be executed from address 0. b HandlerReset still executes the Flash image code, and the program can be executed normally. However, LDR PC, = HandlerReset will make PC point to 0x20000000+offset, which is located in SDRAM. At this time, the code has not been copied, and there is no code in SDRAM, so the program cannot run.
Previous article:About the processing of macro definitions in ARM assembly
Next article:Notes on jump instructions in ARM assembly
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 Hall----Mentor Expedition VX2.3 four-layer Bluetooth product
- EEWORLD University - Key points of analog front-end design for power grid automation equipment and TI solutions
- [Resource Download] STM32CubeExpansion MEMS1 V6.2.0
- Configuration and use of TI C2000 TMS320F28379D SCID SCIB
- MSP430 single chip microcomputer makes intelligent digital multimeter circuit diagram + program
- DSP28335 ECAP module configuration issue
- EEWORLD University Hall----Principles and Applications of Sensors (Tongji University)
- 【Qinheng Trial】CH554 Unboxing
- EEWORLD University ---- Operating System (RISC-V)
- [Zero-knowledge ESP8266 tutorial] Quick Start 7- Make a buzzer