I am using Keil MDK-ARM version for FRDM-KL25Z128xxx4 board. I have downloaded all the required packages using the pack installer.
When I create a new project and build the following code, I get the following error even though I have it included:
area sample, code, readonly export __main __main mov r1,r2 mov r3,r2 end
Hi MaharshiP,
Why did you modify the source code, so that it does not match the error anymore? So your screenshots are just confusing and make helping you difficult.
But ok, the assembler (armasm in this case) does not understand the C preprocessor syntax on its own. So, you get this error. So, remove it.
Then it is generally not a good idea to use the label "__main" in your code, because this is already used in the Arm runtime library. You should start your program at "main" unless you want to put your code already in the reset handler.
So, I suggest the following for your "Sample.s":
area sample, code, readonly import __ARM_use_no_argv export main main PROC mov r1,r2 mov r3,r2 ENDP end
You see 3 changes to your version:
1. I renamed "__main" to "main".
2. As you have main() in assembler, the compiler can't see, that it takes no arguments. That's why you manually need to reference the __ARM_use_no_argv symbol to prevent some unwanted code to be pulled in.
3. added PROC/ENDP to make the debugger aware of this function. Otherwise, you could not step the code in your assembler source.
With this, your program should run to main() and you can single step from thereon. Hope this helps.