Hi I'm using the Keil uVision compiler for ARM assembly. I'm just starting out learning this and I have the following code in my program.
AREA PROGRAM, CODE, READONLY
EXPORT SYSTEMINIT
EXPORT __MAIN
SYSTEMINIT
__MAIN
MOV R1, #0X25
MOV R2, #0X23
END
When I build the target it says
test.s(1): error: A1163E: Unknown opcode PROGRAM, , expecting opcode or Macro
I'm not sure why that is. The code above s the code I was given to run as a sample to make sure its working. Shouldn't I be able to put anything in for AREA? Any help is appreciated.
That error message is informative, if a little hard to decipher: anything that starts in the first column is considered to be a label, so the assembler sees a label named "AREA", then tries to interpret "PROGRAM," as a mnemonic, macro, or directive, which obviously fails since it isn't.
In short, directives need to be indented, just like instructions; this assembles just fine:
AREA PROGRAM, CODE, READONLY
EXPORT SYSTEMINIT
EXPORT __MAIN
SYSTEMINIT
__MAIN
MOV R1, #0X25
MOV R2, #0X23
END