Created
April 6, 2016 07:29
-
-
Save tsunghanlin/05f311f11d3bb670c0e7ce40324fcf88 to your computer and use it in GitHub Desktop.
Makefile for ARMv8 semihosting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET = test.elf | |
CROSS_COMPILE = aarch64-elf- | |
CC = $(CROSS_COMPILE)gcc | |
LD = $(CROSS_COMPILE)ld | |
CSRC = init.c trap.c | |
ASM_SRC = entry.S trap.S | |
CFLAGS += -mcpu=cortex-a53 | |
CFLAGS += -specs=rdimon.specs | |
CFLAGS += -nostartfiles | |
CFLAGS += -g -DDEBUG | |
CFLAGS += -Wall -Wextra -Werror -Wpedantic | |
LDFLAGS += -T./kernel.ld | |
QEMU = QEMU_AUDIO_DRV=none qemu-system-aarch64 | |
QEMU_OPTS += -semihosting -nographic | |
QEMU_OPTS += -cpu cortex-a53 -smp 1 | |
QEMU_OPTS += -monitor null -serial null -parallel null | |
QEMU_OPTS += -machine virt -m 2G | |
.PHONY: all clean qemu debug | |
all: $(TARGET) | |
%.elf: $(CSRC) $(ASM_SRC) | |
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ | |
qemu: $(TARGET) | |
$(QEMU) $(QEMU_OPTS) -kernel $< | |
@stty isig icanon echo | |
debug: $(TARGET) | |
$(QEMU) $(QEMU_OPTS) -S -s -kernel $< | |
@stty isig icanon echo | |
clean: | |
@rm -f $(TARGET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment