Connect with us

Assembly code for arm

Discussion in 'Microcontrollers, Programming and IoT' started by vead, Apr 26, 2014.

Scroll to continue with content
  1. vead

    vead

    473
    14
    Nov 27, 2011
    I am beginner for arm I just want to learn assembly for arm keil software
    I have written code for addition
    Code:
    Area   example , code  readonly
    entry
    
    start
    mov R0 #5
    mov R1#3
    add R0, R0,R1
    stop B stop
    End 
    I am seeing 7 error massage
    assembling lcd.asm...
    lcd.asm(1): error A9: SYNTAX ERROR
    lcd.asm(2): error A9: SYNTAX ERROR
    lcd.asm(3): error A9: SYNTAX ERROR
    lcd.asm(4): error A9: SYNTAX ERROR
    lcd.asm(5): error A9: SYNTAX ERROR
    lcd.asm(6): error A38: NUMBER OF OPERANDS DOES NOT MATCH INSTRUCTION
    lcd.asm(7): error A9: SYNTAX ERROR
    lcd.asm - 7 Error(s), 0 Warning(s).
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    Odd that the assembler is reporting a syntax error for line 3, which is blank!

    Are your directives and instructions indented from the left column?

    Is "start" a label? Usually these need a colon at the end. (Where they're defined, not where they're referenced.)

    Find some sample code and compare it to your code. The problem should become obvious.
     
  3. vead

    vead

    473
    14
    Nov 27, 2011
    Code:
    Area   example , code  readonly
    entry
    
    start
        mov R0, #5    ;  load value into R0
        mov R1,#3   ;   load value into R1
        add R0, R0,R1
    stop
        B stop     ; I don't what is this
    End 
    
    why does we use this line
    Area example , code readonly
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    I don't know. I don't know ARM assembly language. What does the assembler manual say about it? Have you checked my other suggestions?
     
  5. gorgon

    gorgon

    603
    24
    Jun 6, 2011
    As far as I can see from comparing your code with an example in the 'ARM Assembly Language - an Introduction' by J.R. Gibson, the only actual fault you have, is to use a mixed upper/ lower case to the directive Area,. You can use either upper OR lower case, but NOT a mix. Since the AREA directive is the first directive for the program block, it is natural that all the rest of the code is not recognized after missing the directive.
    The case rules are the same for mnemonics too, select the case you want to use, and no mixing upper / lower case.

    why does we use this line
    Area example , code readonly


    This line tells the assembler that AREA is a section of the program with additional options. CODE and READONLY indicate that the section contain instructions and that code produced may be put in readonly memory. 'example' is the title of the program, chosen by the programmer.

    The B stop is an instruction to branch always to 'stop'. The effect is to let the program loop until the operator break from the IDE.
     
    Last edited: Apr 27, 2014
  6. Fahid Bin Tariq

    Fahid Bin Tariq

    1
    0
    Oct 14, 2017
    dear first of all you are making two labels then assign colon:)) in-front of them
    like
    start:

    stop:

    2nd syntax error is in add command!
    this is correct one.
    ADD Rd,Rr
    similarly,
    MOV R , value
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-