Set development environment with UART debug output for aarch64

This commit is contained in:
2019-05-30 08:44:01 +02:00
parent 8718f035a5
commit 08ffb6ee94
8 changed files with 50 additions and 63 deletions
+14 -10
View File
@@ -6,14 +6,13 @@ AARCH64_TOOLCHAIN ?= aarch64-linux-gnu
# Shortcuts
CC=clang --target=aarch64-none-elf -mcpu=cortex-a57
# CC=$(AARCH64_TOOLCHAIN)-gcc
LD=$(AARCH64_TOOLCHAIN)-ld
LD=ld.lld
OBJCOPY=$(AARCH64_TOOLCHAIN)-objcopy --target elf64-littleaarch64
CFLAGS += -O0
CFLAGS += -g
CFLAGS += -nostdlib
CFLAGS += -march=armv8-a
#CFLAGS += -nostdlib
#CFLAGS += -march=armv8-a
#CFLAGS += -std=c99
#CFLAGS += -pedantic
#CFLAGS += -Wall
@@ -26,7 +25,7 @@ BUILD_DIR=build
# Files
KERNEL_MEMMAP = sys/memmap
KERNEL_MEMMAP = aarch64/memmap
KERNEL_SOURCES = \
aarch64/boot.s \
@@ -45,7 +44,7 @@ kernel: $(BUILD_DIR)/kernel.elf # $(BUILD_DIR)/kernel.sym
$(BUILD_DIR)/kernel.elf: $(KERNEL_OBJS)
$(info linking target: $@)
$(LD) -T$(KERNEL_MEMMAP) $^ -o $@
$(LD) -T$(KERNEL_MEMMAP) -nostdlib $^ -o $@
$(info done: $@)
$(BUILD_DIR)/kernel.bin: $(BUILD_DIR)/kernel.elf
@@ -66,14 +65,15 @@ $(BUILD_DIR)/%.o: %
# helpers
QEMU_CMD = \
qemu-system-aarch64 \
-M virt \
-cpu cortex-a57 \
-machine type=virt \
-nographic \
-smp 4 \
-m 4098 \
-m 4096 \
-kernel build/kernel.elf \
-serial stdio \
-monitor none
-monitor none \
clean:
rm -Rf ./$(BUILD_DIR)/*
@@ -83,4 +83,8 @@ run: kernel
debug: kernel
$(QEMU_CMD) -gdb tcp::1234 -S
$(QEMU_CMD) -S -gdb tcp::1234 & \
gdb-multiarch -q \
-ex 'file build/kernel.elf' \
-ex 'target remote localhost:1234'
kill %1