ARM Learning Notes 2 - Branch Jump Instructions

Publisher:转眼人老Latest update time:2020-02-20 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Arm instruction condition codes and condition mnemonics

2. Jump instruction B

  1. Function

    Jump instruction B causes the program to jump to the specified address to execute the program (the jump range is PC-32MB to PC+32MB)

  2. Instruction format (Note: If there is a condition after B, the condition is immediately after B, without a space)

    B{}

  3. Parameter Description

    3.1, : It indicates the conditions under which the instruction is executed, which can be omitted

    3.2, : The target address of the instruction jump. The instruction calculates the target address by the following method:

      A. Extend the 24-bit signed complement immediate value to 32 bits

      B. Shift the expanded 32-bit immediate value left by two bits

      C. Add the obtained value to the PC register to get the jump target address


3. Jump instruction BL with connection

  1. Function

     The jump instruction with connection BL copies the address of the next instruction to the r14 (i.e. return address connection register LR) register, and then jumps to the specified address to run the program.

  2. Syntax format

     BL{}  

  3. Parameter description is the same as instruction B

 

4. Jump instruction BX with state switching

  1. Function

    Make the program jump to the address specified by the parameter Rm specified in the instruction to execute the program

  2. Syntax format

    BX{}

  3. Parameter Description

     contains the target address of the jump instruction,


5. Connection jump instruction BLX with state switching

  1. Function

    Used to make the program jump to Thumb state or return from Thumb state. This instruction is an unconditional execution instruction, and uses the lowest bit of the branch register to update the T bit in CPSR and write the return address to the link register LR.

  2. Syntax format

     BLX{

  3. Parameter Description

     is the jump target address of the instruction, which is calculated according to the following rules

    A. Sign-extend the 24-bit offset specified by the instruction to form a 32-bit immediate value

    B. Shift the result left by two places

    C. Add bit H (bit [24]) to the first bit of the result address (bit [1])

    D. Add the result to the program counter PC

Reference address:ARM Learning Notes 2 - Branch Jump Instructions

Previous article:ARM Study Notes 3 - Data Processing Instructions
Next article:ARM Study Notes 1——The relationship between Arm registers and modes

Recommended ReadingLatest update time:2024-11-22 13:56

Keil's ERROR L107: ADDRESS SPACE OVERFLOW problem
ERROR L107: ADDRESS SPACE OVERFLOW problem cause analysis and solution   When compiling a program using KEIL in small mode, an error often occurs, with the following message.    *** ERROR L107: ADDRESS SPACE OVERFLOW  ... ...  Program Size: data=217.6 xdata=0 code=5314  Target not created    The chip I
[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号