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

ARM: Help with instruction ADD with Operand2

Hi,

New to ARM and I don't understand why following doesn't work.

Using Cortex-M3,uVision I get the error 'Expecting constant expression'

ADD R1,R2,R3,ASR R4

All instruction references I can find give the form 'ADD Rd,Rn, <Operand2>'
and listed under 'Operand2' is 'Rm LSL Rs' so the 'ASR R4' should be legal.

Any help to clear this up would be appreciated.

Thanks

Parents
  • Cortex-M3: ARMv7-M Architecture with Thumb-2 ISA

    Assembler Syntax for ADD instruction:

    ADD{S}<c><q> {<Rd>,} <Rn>, <Rm> {,<shift>}
    
    <c>      Condition
    <q>      Qualifier
    <Rd>     Destination register
    <Rn>     Register that contains the first operand.
    <Rm>     Register  that is optionally shifted and used as the second operand
    <shift>  Optional shift applied to value read from <Rm>:
             LSL #<n> | LSR #<n> | ASR #<n> | ROR #<n> | RRX
    
    

    Example:

    ADD R1,R2,R3,ASR #4
    

Reply
  • Cortex-M3: ARMv7-M Architecture with Thumb-2 ISA

    Assembler Syntax for ADD instruction:

    ADD{S}<c><q> {<Rd>,} <Rn>, <Rm> {,<shift>}
    
    <c>      Condition
    <q>      Qualifier
    <Rd>     Destination register
    <Rn>     Register that contains the first operand.
    <Rm>     Register  that is optionally shifted and used as the second operand
    <shift>  Optional shift applied to value read from <Rm>:
             LSL #<n> | LSR #<n> | ASR #<n> | ROR #<n> | RRX
    
    

    Example:

    ADD R1,R2,R3,ASR #4
    

Children