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

Immediate offset problem with the LDR commands

Compiler give error message for following codes.
A1174E: "Data transfer offset 0x00000102 out of range. Permitted values are 0x00..0x1F"

    LDR   R1,=USB_BASE
    LDRB  R0,[R1,#USB0_CSRL0] ; Error code is A1174E !!!!

USB_BASE   EQU 0x40050000
USB0_CSRL0 EQU 0x102

But compiler dont give any error if i write this program thats way

USB_BASE   EQU 0x40050000
USB0_CSRL0 EQU 0x102

    LDR   R1,=USB_BASE
    LDRB  R0,[R1,#USB0_CSRL0] ; Error code is A1174E !!!!

What is wrong?

Parents Reply Children
  • My first message wrong written.

    Compiler give error message for following codes.

    A1174E: "Data transfer offset 0x00000102 out of range. Permitted values are 0x00..0x1F"
    
        LDR   R1,=USB_BASE
        LDRB  R0,[R1,#USB0_CSRL0] ; Error code is A1174E !!!!
    
    USB_BASE   EQU 0x40050000
    USB0_CSRL0 EQU 0x102
    

    But compiler dont give any error if i write this program thats way

    USB_BASE   EQU 0x40050000
    USB0_CSRL0 EQU 0x102
    
        LDR   R1,=USB_BASE
        LDRB  R0,[R1,#USB0_CSRL0] ; No error !!!!
    

    What is wrong in first one which gives error?

    ----------------------------------------

    Could you please answer my question, and discuss yours anywhere else.

  • Why? You're not listening to anything that anyone tells you anyhow.

    You still don't understand the difference between an Assembler and a Compiler.
    Understanding & paying attention to subtle distinctions like that is absolutely fundamental if you want to be an Assembly programmer.

    If you consider such details too trivial for you to bother with, then Assembly programming is not for you.

  • @Andrew

    Assembler and/or compiler not importand details for my main question.

    Please focus on the main question. Else you cant see and you cant understand the niceties in my questions. Because your brain looking other destinations.

  • You_little_tyrant       equ 1
          MOV R0,#You_little_tyrant ; No error !!!!
    
         MOV R0,#You_little_tyrant ; No error !!!!
    You_little_tyrant       equ 1
    
    USB_BASE   EQU 0x40050000
    USB0_CSRL0 EQU 0x102
    
        LDR   R1,=USB_BASE
        LDRB  R0,[R1,#USB0_CSRL0] ; No error !!!!
    

    But folowing program produce the error code A1174E !!!!

    LDR R1,=USB_BASE LDRB R0,[R1,#USB0_CSRL0] ; Error code is A1174E !!!!

    USB_BASE EQU 0x40050000
    USB0_CSRL0 EQU 0x102

    I think Keil assembler has a bug.

    Because folowing error meaningless for the LDR assembly command.

    A1174E: "Data transfer offset 0x00000102 out of range. Permitted values are 0x00..0x1F"

    Isnt it Tamir ?

  • Sory;

    You_little_tyrant       equ 1
          MOV R0,#You_little_tyrant ; No error !!!!
    
         MOV R0,#You_little_tyrant ; No error !!!!
    You_little_tyrant       equ 1
    
    USB_BASE   EQU 0x40050000
    USB0_CSRL0 EQU 0x102
    
        LDR   R1,=USB_BASE
        LDRB  R0,[R1,#USB0_CSRL0] ; No error !!!!
    

    But folowing program produce the error code A1174E !!!!

        LDR   R1,=USB_BASE
        LDRB  R0,[R1,#USB0_CSRL0] ; Error code is A1174E !!!!
    
    USB_BASE   EQU 0x40050000
    USB0_CSRL0 EQU 0x102
    

    I think Keil assembler has a bug.

    Because folowing error meaningless for the LDRB assembly command.

    A1174E: "Data transfer offset 0x00000102 out of range. Permitted values are 0x00..0x1F"

    Isnt it Tamir ?

  • If the offset is limited to 0x00 to 0x1f does depend on a couple of things, doesn't it?

    For example what chip you have, or what mode you are assembling (not compiling) for. Have you maybe seen the limit 0 to 31 somewhere in any instruction set descriptions?

    By the way - when you did decide that the assembler had a bug - did you check what the produced op code result was from your source code?

  • Are you going to read the assembler manual anytime soon or what?!

  • So sorry i forget to said "I use cortex m3 family".

  • Find out and think about the differences between these two instructions below and what a two pass assembler is faced with in the two situations above.

    LDRB.N  R0,[R1,#USB0_CSRL0]
    LDRB.W  R0,[R1,#USB0_CSRL0]
    

  • @Per Westermark

    My processor is CM3. Limits of Immediate ofset mode of the LDR command are -255 to 4095.

    Therefore i think Keil assembler gives a wrong error message.

  • I know the differences of .N and .W suffix. Limits of the immediate offset of the cortex m3 LDR command can not be between the 0x00 and 0x1F. Therefore assembler gives wrong error.

  • Assembler and/or compiler not importand details for my main question.

    You don't know that. You have no idea what's important for your main question and what isn't.

    Else you cant see and you cant understand the niceties in my questions.

    There are no "niceties" to be found in any of the pointless repetitions of your question. Just the obnoxiousness of a person who asks a question, then is so sure he knows the answer better than the people he asked, that he considers himself qualified to dismiss answers as unhelpful without so much as pretending to consider them first.

    You don't want any help, fine --- so stop wasting everybody's time by pretending to ask for it.

  • I found the answer for my first question and i wrote it. This is an assembler's problem and i think at the next versions Keil repairs.

    If you look at the answers to my question unrelated ordinary conceivable that you will see the answers.

    I'm not coming here to chat or controversy. I'm coming to find a single reply of my question I was just right.

    At the same time the problem is only missing my Ingilizce Caused by.