print to uart0 [note: always printed on screen through DMA]
[cortex-from-scratch] / Makefile
index cc01e47..f75c606 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,24 @@
-CC=$(TOOLROOT)/arm-none-eabi-gcc
+CC=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 
+CFLAGS+= -mcpu=cortex-m3 -mthumb -g 
 
 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
+       $(CC) $(CFLAGS) -c -I./include -ffreestanding -o main.o main.c
+       $(CC) $(CFLAGS) -c -I./include -ffreestanding -o uart.o uart.c
+       $(LD) -nostartfiles -T link.ld -o start.out start.o main.o uart.o
+       $(MKIMG) -Obinary -R .data start.out kernel.bin
 
 run:
-       qemu-system-arm -monitor stdio -M lm3s6965evb -kernel kernel.bin
+       qemu-system-arm -serial stdio -M lm3s6965evb -kernel kernel.bin
 
 examine:
        arm-none-eabi-objdump -S start.out