Search code examples
assemblyarmkeil

Arm error A1174E: Data transfer offset 0x00002000 out of range. Permitted values are 0xFFFFF001 to 0x00000FFF


I have a simple assembly which generated the following error

Assembly

LDR r14,[r12,#0x00002000]

Error

testspeed.s(23): error: A1174E: Data transfer offset 0x00002000 out of range.  Permitted values are 0xFFFFFF01 to 0x00000FFF

Looking up at the ARM guide i see the reason for the error

 A1174E: Data transfer offset 0x<val> out of range. Permitted values are 0x<mini> to 0x<maxi>

Anyone know what is this 0x<mini> and 0x<maxi> ? And where is it set ? Can i control it.


Solution

  • This is a limitation of the ARM instruction set. Per the documentation:

    Instruction           Immediate offset     Pre-indexed      Post-indexed     Arch.
    ARM, word or byte [1] -4095 to 4095        -4095 to 4095    -4095 to 4095    All 
    

    (For some reason, the minus signs are missing from the documentation.)

    Your offset is too large to be used as an immediate. You'll have to come up with some other way to access the memory, say, by breaking it up into two instructions.

    ADD r14, r12, #0x00002000
    LDR r14, [r14]