Skip to main content

IAR Embedded Workbench for Arm 9.70.x

ADR (THUMB)

In this section:
Syntax
ADR{condition} register,expression
Parameters

{condition}

An optional condition code if the instruction is placed after an IT instruction.

register

The register to load.

expression

A program-relative expression that evaluates to an address within the range -4095 to 4095 bytes.

Description

Similar to ADR (CODE16), but the address range can be larger if a 32-bit Thumb-2 instruction is available in the architecture used.

If the address offset is positive and the address is word-aligned, the 16-bit ADR (CODE16) version will be generated by default.

The 16-bit version can be specified explicitly with the ADR.N instruction. The 32-bit version can be specified explicitly with the ADR.W instruction.

Example
            name    thumbAdr
            section MYCODE:CODE(2)

            thumb
            adr     r0,dataLabel    ; Becomes "add r0,pc,#4".
            add     r0,r0,r1
            bx      lr

            data
            alignrom 2
dataLabel   dc32    0xABCD19

            end
See also

ADR (CODE16) if only 16-bit Thumb instructions are available.