2019-12-01 22:57:02 +01:00
|
|
|
# environment
|
|
|
|
|
|
|
|
include ../Makevars.mk
|
|
|
|
|
|
|
|
# CFLAGS
|
|
|
|
|
|
|
|
CFLAGS += -O0
|
|
|
|
CFLAGS += -g
|
|
|
|
CFLAGS += -nostdlib
|
|
|
|
CFLAGS += -march=armv8-a
|
|
|
|
# CFLAGS += -std=c99
|
|
|
|
# CFLAGS += -pedantic
|
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wmissing-prototypes
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
|
|
|
CFLAGS += -Wold-style-definition
|
|
|
|
|
|
|
|
INCS += -I./
|
|
|
|
|
|
|
|
# SOURCES
|
|
|
|
|
|
|
|
LD_SCRIPT = aarch64/aarch64.ld
|
|
|
|
|
|
|
|
SOURCE_FILES = \
|
2020-01-15 10:56:04 +01:00
|
|
|
aarch64/aarch64_boot.S \
|
2019-12-01 22:57:02 +01:00
|
|
|
aarch64/aarch64.S \
|
|
|
|
\
|
2020-01-15 10:56:04 +01:00
|
|
|
leos/irq.c \
|
|
|
|
leos/leos.c \
|
|
|
|
leos/log.c \
|
|
|
|
leos/memory.c \
|
|
|
|
leos/task.c \
|
2019-12-01 22:57:02 +01:00
|
|
|
\
|
2020-01-15 10:56:04 +01:00
|
|
|
drivers/timer/timer.c \
|
|
|
|
drivers/uart/uart_mini.c \
|
|
|
|
drivers/uart/uart_qemu.c \
|
2019-12-01 22:57:02 +01:00
|
|
|
|
|
|
|
SOURCE_LIST := $(wildcard $(SOURCE_FILES))
|
|
|
|
OBJECT_FILES := $(addsuffix .o, $(addprefix $(BUILD_DIR), ${SOURCE_LIST}))
|
|
|
|
|
|
|
|
# rules
|
|
|
|
|
|
|
|
all: kernel
|
|
|
|
|
|
|
|
default: kernel
|
|
|
|
|
2019-12-02 12:59:40 +01:00
|
|
|
kernel: $(BUILD_DIR)kernel.elf $(BUILD_DIR)kernel.list $(BUILD_DIR)kernel.bin
|
2019-12-01 22:57:02 +01:00
|
|
|
|
|
|
|
$(BUILD_DIR)kernel.elf: $(OBJECT_FILES)
|
|
|
|
$(info linking target: $@)
|
|
|
|
$(AARCH64_LD) -T$(LD_SCRIPT) -nostdlib $^ -o $@
|
|
|
|
$(info done: $@)
|
|
|
|
|
2019-12-02 12:59:40 +01:00
|
|
|
$(BUILD_DIR)kernel.list: $(BUILD_DIR)kernel.elf
|
|
|
|
$(AARCH64_OBJCOPY) -D $(BUILD_DIR)kernel.elf > $@
|
|
|
|
|
2019-12-01 22:57:02 +01:00
|
|
|
$(BUILD_DIR)kernel.bin: $(BUILD_DIR)/kernel.elf
|
|
|
|
$(AARCH64_OBJCOPY) -O binary $< $@
|
2019-12-02 12:59:40 +01:00
|
|
|
cp $@ $(BUILD_DIR)kernel8.img
|
2019-12-01 22:57:02 +01:00
|
|
|
|
|
|
|
$(BUILD_DIR)kernel.sym: $(BUILD_DIR)/kernel.elf
|
|
|
|
$(AARCH64_OBJCOPY) --only-keep-debug $< $@
|
|
|
|
$(AARCH64_OBJCOPY) --strip-debug $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)%.o: %
|
|
|
|
$(info compiling file: $<)
|
|
|
|
@mkdir -p $(dir ./$(BUILD_DIR)$<)
|
|
|
|
$(AARCH64_CC) $(INCS) $(CFLAGS) -c $< -o $@
|
|
|
|
|