Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 1.88 KB | None | 0 0
  1. Stack_Size      EQU     0x00000400
  2.            
  3.                 AREA    STACK, NOINIT, READWRITE, ALIGN=3
  4. Stack_Mem       SPACE   Stack_Size
  5. __initial_sp
  6.  
  7. Heap_Size       EQU     0x00000200
  8.  
  9.                 AREA    HEAP, NOINIT, READWRITE, ALIGN=3
  10. __heap_base
  11. Heap_Mem        SPACE   Heap_Size
  12. __heap_limit
  13.  
  14.  
  15.  
  16.                 AREA    RESET, DATA, READONLY
  17.                     EXPORT  __Vectors
  18. __Vectors       DCD     __initial_sp            ; Top of Stack
  19.                 DCD     Reset_Handler           ; Reset Handler
  20. __Vectors_End
  21.                  
  22.                  
  23.                  
  24.                  
  25.                  
  26.                  
  27.                  
  28.                  
  29.                 AREA    |.data|, DATA, NOINIT, READWRITE
  30. input_vars
  31. s               DCD 0x0
  32. t               DCD 0x0    
  33. u               DCD 0x0
  34. v               DCD 0x0  
  35. h               DCD 0x0
  36.  
  37. output_vars
  38. lx              DCD 0x0
  39. hx              DCD 0x0    
  40. y               DCD 0x0
  41. z               DCD 0x0  
  42.                                                                                  
  43.                 AREA    |.text|, CODE, READONLY
  44. Const_c DCD 2 ;Constant in memory
  45. Const_e DCD 7 ;Constant in memory
  46.                        
  47.                        
  48.            
  49.  
  50.  
  51.                        
  52. main            PROC
  53.                  
  54.                 MOV R0, #15
  55.                
  56. CONST_A EQU -10 ;Macro constant
  57. CONST_B EQU 3 ;Macro constant
  58.                 MOV R0, #CONST_A ;R0 = CONST_A = a
  59.                 MOV R1, #CONST_B ;R1 = CONST_B = b
  60.                
  61.                 ADD R2, R0, R1 ;R2 = R0 + R1 = CONST_A + CONST_B
  62.                
  63.                 BX      LR
  64.                 ENDP
  65.                        
  66.  
  67.  
  68.                 LDR R4, =Const_c ;R4 = &Const_c
  69.                 LDR R2, [R4] ;R2 = *(R4) =Const_c
  70.                 LDR R3, =Const_e ;R3 = &Const_e
  71.                 LDR R3, [R3] ;R3 = *(&Const_e) = Const_e
  72.  
  73.  
  74.                        
  75. Reset_Handler   PROC
  76.                 EXPORT  Reset_Handler             [WEAK]    
  77.                 BL main
  78.                 B       Reset_Handler
  79.                 ENDP
  80.                 END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement