Create an Assembly Project

Creating an Assembly project is pretty much the same as createing a C project.




TypeChoose “Asm File (.s)”.
NameChoose an appropriate name.
LocationChoose correct location (.\App).

To create a “normal” Assembly project you just have to add Assembly files to the project instead of C files.
The example code bellow shows a minimal main procedure.

main.s
                 AREA myCode, CODE, READONLY 
 
                 THUMB 
 
ADDR_LED         EQU    0x60000100 
ADDR_DIPSW       EQU    0x60000200 
 
main             PROC 
                 EXPORT main 
 
                 LDR    R0, =ADDR_LED 
                 LDR    R1, =ADDR_DIPSW 
loop             LDR    R2, [R1, #0] 
                 STR    R2, [R0, #0] 
                 B      loop 
 
                 ENDP 
 
                 ALIGN 
                 END 


The difference between a normal an d a minimal Assembly project is, that for the minimal project you don't need to choose a runtime component. This means you have to take care of every aspect yourself!
The example code bellow shows a very minimal setup (without access to the CT Board input or output peripherals).

main.s
                AREA RESET, DATA, READONLY 
                EXPORT __Vectors 
__Vectors 
                DCD  0x2002ffff             ; top of stack 
                DCD  Reset_Handler          ; reset vector 
 
 
                AREA myCode, CODE, READONLY 
 
                THUMB 
 
CONST_VALUE_X   EQU  12 
 
 
                ENTRY 
Reset_Handler 
 
; -- Your code belongs here --------------------------------- 
 
                LDR  R0, =0 
                LDR  R1, =CONST_VALUE_X 
loop            ADD  R0, R1 
                B    loop 
 
; -- Your code ends here ------------------------------------ 
 
                END 



Back to Getting Started

  • software/keil/asm_project.txt
  • Last modified: 2020/02/07 16:20
  • by akdi