warn = -pedantic -Wall
dbg = -g
-inc = -Isrc/libc
-gccopt = -fpic -ffreestanding -nostdinc
-arch = -mcpu=arm1176jzf-s
+inc = -Isrc -Isrc/libc
+gccopt = -marm -fno-pic -ffreestanding -nostdinc -ffast-math -fno-math-errno -MMD
+#arch = -mcpu=arm1176jzf-s
+arch = -mcpu=cortex-a7
CFLAGS = $(arch) $(warn) $(opt) $(dbg) $(gccopt) $(inc) $(def)
ASFLAGS = $(arch) $(dbg) $(inc)
LDFLAGS = -nostdlib -T rpikern.ld -print-gc-sections
-QEMU_FLAGS = -m 256 -M raspi2 -serial stdio
+QEMU_FLAGS = -vnc :0 -m 1024 -M raspi2 -serial stdio -d guest_errors
$(bin): $(elf)
$(OBJCOPY) -O binary $< $@
-$(elf): $(obj)
+$(elf): $(obj) rpikern.ld
$(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
-include $(dep)
-%.d: %.c
- @echo 'gen dep $@ ...'
- @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
-
.PHONY: clean
clean:
rm -f $(obj) $(bin) $(elf) link.map
cleandep:
rm -f $(dep)
-.PHONY: debug
-debug: $(elf)
+.PHONY: run
+run: $(elf)
qemu-system-arm $(QEMU_FLAGS) -kernel $(elf)
+
+.PHONY: disasm
+disasm: $(elf)
+ $(toolprefix)objdump -D $<
+
+.PHONY: install
+install: $(bin)
+ cp $(bin) /srv/tftp/$(bin)