From: John Tsiombikas Date: Sun, 14 Aug 2016 13:47:06 +0000 (+0000) Subject: initial commit X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=armsys initial commit --- 6f1f42f5aec36978b03ef5e6fa0c6a0008613df7 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e44b643 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c) +asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S) +dep = $(asmsrc:.S=.d) $(csrc:.c=.d) +obj = $(asmsrc:.S=.o) $(csrc:.c=.o) + +inc = -Isrc -Isrc/klibc -Isrc/boot -Iinclude + +CFLAGS = $(ccemu) -Wall -g -nostdinc -fno-builtin $(inc) -DKERNEL +ASFLAGS = $(ccemu) -g -nostdinc -fno-builtin $(inc) + +bin = kernel.elf + +$(bin): $(obj) + ld $(ldemu) -o $@ -Ttext 0x8000 -e kentry $(obj) -Map link.map + +%.s: %.c + $(CC) $(CFLAGS) -S -o $@ $< + +-include $(dep) + +%.d: %.c + @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ + +%.d: %.S + @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@ + +.PHONY: clean +clean: + rm -f $(obj) $(bin) + +.PHONY: cleandep +cleandep: + rm -f $(dep) diff --git a/src/boot/lboot.S b/src/boot/lboot.S new file mode 100644 index 0000000..1e56e95 --- /dev/null +++ b/src/boot/lboot.S @@ -0,0 +1,12 @@ +#define STACK_SIZE 0x4000 + + .text + .align 4 + + .globl kentry +kentry: + ldr sp, =$(stack + STACK_SIZE) + + bl kmain + + .comm stack, STACK_SIZE