This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ask for helps in instruction:ADR{cond} Rd, label

Note: This was originally posted on 3rd September 2012 at http://forums.arm.com

ADR.W    R1,F4_ROM       ;F4_ROM is the label of the table below
    STR     R1,[R0]
    ..........
F4_ROM
    .short   0x100,0x200
    .short   0x300,0x400

when i use the instruction ADR.W above,the compiler tells : [E0200] Offset out of range.how can i  solve the promble? thanks.

Parents
  • Note: This was originally posted on 3rd September 2012 at http://forums.arm.com

    ADR.W    R1,F4_ROM    ;F4_ROM is the label of the table below
    when i use the instruction ADR.W above,the compiler tells : [E0200] Offset out of range.how can i  solve the promble? thanks.


    ADR is relative to PC. i.e the label need to be quite near to the ADR instruction (to be simple).

    Use movw and movt



       movw        r1, #:lower16:F4_ROM
       movt        r1, #:upper16:F4_ROM


    the code needs 2 instructions instead of one but it will works in all case !
Reply
  • Note: This was originally posted on 3rd September 2012 at http://forums.arm.com

    ADR.W    R1,F4_ROM    ;F4_ROM is the label of the table below
    when i use the instruction ADR.W above,the compiler tells : [E0200] Offset out of range.how can i  solve the promble? thanks.


    ADR is relative to PC. i.e the label need to be quite near to the ADR instruction (to be simple).

    Use movw and movt



       movw        r1, #:lower16:F4_ROM
       movt        r1, #:upper16:F4_ROM


    the code needs 2 instructions instead of one but it will works in all case !
Children
No data