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.

  • Note: This was originally posted on 4th September 2012 at http://forums.arm.com


    Try:

      LDR  r1, =F4_ROM


    hello, the compiler is TI's ccs5.2 ,it does not support   LDR  r1, =F4_ROM. now i want to use the first address of the table,is there other instructions functions?i know  LDR  r1, =F4_ROM is supported by KEIL.
  • Note: This was originally posted on 4th September 2012 at http://forums.arm.com


    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 !

    hello,webshaker, how can i get the lower16/upper16 of the F4_ROM, F4_ROM is not a constant.by the way,the compiler i use is TI's ccs5.2.
  • 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 !
  • Note: This was originally posted on 4th September 2012 at http://forums.arm.com


    hello,webshaker, how can i get the lower16/upper16 of the F4_ROM, F4_ROM is not a constant.by the way,the compiler i use is TI's ccs5.2.


    That's right.
    But the linker know the value of the address F4_ROM

    Just try the code I gave you that should work !
  • Note: This was originally posted on 3rd September 2012 at http://forums.arm.com

    Try:

      LDR  r1, =F4_ROM