Jump instruction with state switching: BX
Assembly format: BX{
Function: The BX instruction jumps to the target address specified in the instruction and switches the state. Rm is a register that expresses the target address. When the lowest bit Rm[0] in Rm is 1, the program is forced to jump from the ARM instruction state to the Thumb instruction state; when the lowest bit Rm[0] in Rm is 0, the program is forced to jump from the Thumb instruction state to the ARM instruction state.
BX instruction example
CODE32; ARM program segment, 32-bit encoding
arm1 ADR R0,thumb1+1; pseudo-instruction, assign the address of statement label thumb1 to
R0, set the last bit R0[0] to 1, jump to THUMB instruction set
; THUMB instruction set
MOV LR,PC; set return address
BX R0; jump
ADD R1,R2,#2; at the return address, the 4th instruction
CODE16; THUMB program segment, 16-bit encoding
thumb1 ADD R1,R3,#1; THUMB program
...
BX LR; jump to the return address, execute the 4th instruction
Analysis: This example illustrates the structure of subroutine call and return with state switching. When the ARM program segment executes the MOV LR, PC statement, the return address is saved in the LR register. When the BX statement is executed, the PC points to the next statement to be executed. At this time, the value in PC (R15) is the address of the next statement ADD instruction, and the switch from ARM state to Thumb state is realized according to bit [0] in R0. Thus, the Thumb subroutine is called. After the subroutine is called, the BX LR instruction is used to realize the return of the subroutine call and switch to ARM state.
Previous article:Understanding and Analysis of "8-bit Bitmap" in ARM Processor
Next article:Data block copying in ARM integrated environment
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Design, production and debugging of flyback switching power supply (by Chen Yongzhen and Chen Zhibo)
- Internet of Things Development Technology Based on C Language (Edited by Gao Song)
- Teach you to learn 51 single chip microcomputer-C language version (Second Edition) (Song Xuefeng)
- 2.1 uboot transplantation in linux
- uboot relocation code analysis
- ECS operating system: hardware platform porting and driver programming
- "Writing Embedded Operating Systems Step by Step" Reading Notes 1—Skyeye Introduction, Installation and HelloWorld
- The relationship between BootLoader and kernel image
- How to use UBOOT's own loadb command to load the application program into SDRAM for execution
- 6410 bare metal program stuck
- Tiny6410--Modulation software settings
- Data block copying in ARM integrated environment
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- iSoftStone and Renesas enter into a partnership to advance automotive underlying technology innovation
- iSoftStone and Renesas enter into a partnership to advance automotive underlying technology innovation
- NXP FXLS8971CF and FXLS8961AF accelerometers improve your precision inclinometer application performance
- NXP FXLS8971CF and FXLS8961AF accelerometers improve your precision inclinometer application performance
- Industry Summit 2024 to stimulate innovation and promote the development of smart energy technologies
- Industry Summit 2024 to stimulate innovation and promote the development of smart energy technologies
- 2.1 uboot transplantation in linux
- uboot relocation code analysis
- ECS operating system: hardware platform porting and driver programming
- "Writing Embedded Operating Systems Step by Step" Reading Notes 1—Skyeye Introduction, Installation and HelloWorld
- Microcontroller programming using C library functions
- msp430 contains ADC12 module program implementation
- 【Development Kit for nRF52840】+Being beaten by nordic
- MCU on-chip memory burning (ROM programming)
- Host power management settings
- CircuitPython is being ported to NXP i.MX RT
- A Engineer's Guide to Instrumentation Amplifiers
- A complete introduction to voltage stabilization, voltage regulation, monitoring, and DC/DC chips
- MicroPython improves support for nrf branches
- Suppression of electromagnetic disturbance in switching power supply