static RAM (.data) usage
[cortex-from-scratch] / start.asm
1         .equ STACK_TOP, 0x20000800
2         .text
3         .global _start
4         .code 16
5         .syntax unified
6 _start:
7         .word STACK_TOP, start
8         .type start, function
9
10 /* Start of main program */
11 start:
12         movs r0, #5
13         movs r1, #1
14 loop:
15         adds r1, r0
16         subs r0, #1
17         bne loop
18         /* Result is now in R1 */
19         ldr r0, =Result
20         str r1, [r0] 
21
22 deadloop:
23         b deadloop
24
25         .data
26         .word 0 /* add two words*/
27         .word 0 
28 Result:
29         .word 0 /* results now is in 0x20000008 (0x20000000 + 2 w) */
30         .end
31