Search code examples
assemblycompiler-errorsarmkeil

Unexpected characters at end of line


I Writing a code that loops 1000 times in assembly language, although I keep getting these errors:

main.s(48): error: A1137E: Unexpected characters at end of line
main.s(53): error: A1137E: Unexpected characters at end of line
main.s(55): error: A1163E: Unknown opcode endloop , expecting opcode or Macro
".\SimpleProject.axf" - 3 Error(s), 0 Warning(s).

Here is an Example of my code:

MOV R0, #1, i = 1;
startloop   
    cmp R0, #1000
    BGT endloop
        ADD R1, R1, R0
        ADD R0, R0, #1, i++;
        B startloop
endloop

line (48) refers to:

MOV R0, #1, i = 1;

Solution

  • Try changing the erroneous line to:

    MOV R0, #1
    

    Clearly i = 1; was supposed to be a comment, but you accidentally typed a comma instead of whatever comment character is supported by your assembler. Read the documentation of your assembler to learn comment syntax.