Simple and Trivial Kernel for Advanced Reduced Instruction Set Computer Machines
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

39 lines
800 B

.POSIX:
TOOLCHAIN=arm-none-eabi-
CCX=$(TOOLCHAIN)g++
CCFLAGS=-c -Wall -fno-stack-protector -ffreestanding -fno-exceptions -march=armv7-a -mno-unaligned-access -nostdlib -Iinclude -g
STRIP=$(TOOLCHAIN)strip
C_HDR=$(wildcard include/*.h)
C_SRC=$(wildcard src/*.cpp)
C_OBJ=$(patsubst src/%.cpp, obj/c_%.o, $(C_SRC))
A_SRC=$(wildcard src/*.s)
A_OBJ=$(patsubst src/%.s, obj/s_%.o, $(A_SRC))
.PHONY: all environ clean
all: environ bin/kernel.elf
strip: bin/kernel.elf
$(STRIP) -s bin/kernel.elf
environ:
mkdir -p bin
mkdir -p obj
bin/kernel.elf: environ $(A_OBJ) $(C_OBJ)
arm-none-eabi-ld --nmagic -nostdlib -T src/linker.ld -o bin/kernel.elf obj/*.o
obj/s_%.o: src/%.s
$(CCX) $(CCFLAGS) -o $@ $<
obj/c_%.o: src/%.cpp $(C_HDR)
$(CCX) $(CCFLAGS) -o $@ $<
clean:
rm -f bin/*
rm -f obj/*