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

LDR Register Assignment

Note: This was originally posted on 22nd February 2012 at http://forums.arm.com

Here I'm doing basic assignments and read write routines for
verfication:


ldr r1, StartRegs
  ...
  StartRegs: .word 0x00000989

This code worked fine, but a few lines down the program I try
to assign r4 a value just like StartRegs.  Instead of being able to
use the same format in the previous code I posted, it was neccessary
to use this format:


  ldr  r4, =EndRegs

  ...

  EndRegs:   .word   0xFFFFFFFF


If I didn't use the "=" operator, r4 was never stored with anything.  My question
is why did I have to use the "=" operator in one part of the code as opposed to
another part of the code?
  • Note: This was originally posted on 29th February 2012 at http://forums.arm.com

    Thanks guys.
  • Note: This was originally posted on 27th February 2012 at http://forums.arm.com


    Here I'm doing basic assignments and read write routines for
    verfication:
       
       
        ldr    r1, StartRegs
            ...
            StartRegs:    .word 0x00000989

    This code worked fine, but a few lines down the program I try
    to assign r4 a value just like StartRegs.  Instead of being able to
    use the same format in the previous code I posted, it was neccessary
    to use this format:


            ldr     r4, =EndRegs

            ...

            EndRegs:         .word      0xFFFFFFFF


    If I didn't use the "=" operator, r4 was never stored with anything.  My question
    is why did I have to use the "=" operator in one part of the code as opposed to
    another part of the code?



    --> One of the above codes loads the data to the register while the other loads the address. This is what I see on the Keil IDE. Not sure why you cannot do method1 twice.
  • Note: This was originally posted on 29th February 2012 at http://forums.arm.com

    ldr rx, [mem], such as
    ldr r0, data1
    data1 .word 0x00001

    ldr rx, =const, such as
    ldr r0, =0x12345678
    Once "=", a const is expected.