First program in assembler using Keil and ARM Cortex M4
(It is important to say that it is compatible with Cortex M3)
Description: In general, this program moves immediate data to registers R0 and R1 and subsequently adds them.
The idea is that you can easily copy the code in Keil and do the respective debugging.
Any question please let me know.
If you want help with a project, a course or consultancy please contact me.
--------------------------------------------------------------------------------------------------------------------------
AREA MYCODE, CODE
ENTRY
EXPORT main
main
MOV r0, #11
MOV r1, #1
ADD r2, r1, r0
B main
END
--------------------------------------------------------------------------------------------------------------------------
AREA
The AREA directive instructs the assembler to assemble a new code or data section. Sections are independent, named, indivisible chunks of code or data that are manipulated by the linker.
Syntax
AREA sectionname{,attr}{,attr}...
AREA Example,CODE, READONLY; An example code section. ; code
ENTRY
The ENTRY directive declares an entry point to a program.
Syntax
ENTRY
Usage
You must specify at least one ENTRY point for a program. If no ENTRY exists, a warning is generated at link time.
You must not use more than one ENTRY directive in a single source file. Not every source file has to have an ENTRY directive. If more than one ENTRY exists in a single source file, an error message is generated at assembly time.
Example
AREA ARMex, CODE, READONLY
ENTRY ; Entry point for the application
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489e/Chdibhie.html