all:
$(AS) $(CFLAGS) -o start.o start.asm
$(LD) -T link.ld -o start.out start.o
- $(MKIMG) -Obinary start.out kernel.bin
+ $(MKIMG) -Obinary -R .data start.out kernel.bin
run:
qemu-system-arm -monitor stdio -M lm3s6965evb -kernel kernel.bin
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ FLASH (xr) : ORIGIN = 0x00000000, LENGTH = 512K
SRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
}
/* Start of main program */
start:
- movs r0, #10
- movs r1, #5
+ movs r0, #5
+ movs r1, #1
loop:
adds r1, r0
subs r0, #1
bne loop
-/* Result is now in R1 */
+ /* Result is now in R1 */
+ ldr r0, =Result
+ str r1, [r0]
+
deadloop:
b deadloop
+
+ .data
+ .word 0 /* add two words*/
+ .word 0
+Result:
+ .word 0 /* results now is in 0x20000008 (0x20000000 + 2 w) */
.end