--- /dev/null
+CC=$(TOOLROOT)/arm-none-eabi-gcc
+LD=arm-none-eabi-ld
+AR=$(TOOLROOT)/arm-none-eabi-ar
+AS=arm-none-eabi-as
+MKIMG=arm-none-eabi-objcopy
+
+LDFLAGS+= -mthumb -mcpu=cortex-m3
+CFLAGS+= -mcpu=cortex-m3 -mthumb
+
+as:
+ $(AS) $(CFLAGS) -o start.o start.asm
+
+all:
+ $(AS) $(CFLAGS) -o start.o start.asm
+ $(LD) -T link.ld -o start.out start.o
+ $(MKIMG) -Obinary start.out kernel.bin
+
+run:
+ qemu-system-arm -monitor stdio -M lm3s6965evb -kernel kernel.bin
+
+examine:
+ arm-none-eabi-objdump -S start.out
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+ $(CC) -MM $(CFLAGS) $< > $*.d
+
+%.o: %.s
+ $(CC) -c $(CFLAGS) $< -o $@
+
+
+
+
--- /dev/null
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ SRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+ENTRY(_start)
+
+SECTIONS
+{
+ .text : ALIGN(4)
+ {
+ /* (.vector_table */
+ *(.text)
+
+ } > FLASH
+ .data :
+ {
+ *(.data)
+ } > SRAM
+}
--- /dev/null
+ .equ STACK_TOP, 0x20000800
+ .text
+ .global _start
+ .code 16
+ .syntax unified
+_start:
+ .word STACK_TOP, start
+ .type start, function
+
+/* Start of main program */
+start:
+ movs r0, #10
+ movs r1, #5
+loop:
+ adds r1, r0
+ subs r0, #1
+ bne loop
+/* Result is now in R1 */
+deadloop:
+ b deadloop
+ .end
+