-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (41 loc) · 866 Bytes
/
Copy pathMakefile
File metadata and controls
47 lines (41 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
TOOLPREFIX ?= ./toolchain/bin/aarch64-none-elf-
CC = $(TOOLPREFIX)gcc
CFLAGS += -g -Wall -ffreestanding -O2
OBJS=\
entry.o \
panic.o \
switch.o \
trap.o \
init.o \
mmu.o \
alloc.o \
intr.o \
task.o \
gpio.o \
uart.o \
i2c.o \
bme280.o \
ssd1306.o \
bitmap.o
.PHONY: all qemu qemu-gdb gdb clean
all: kernel8.img
kernel8.elf: $(OBJS)
$(TOOLPREFIX)ld -nostdlib $^ -T kernel8.ld -o $@
kernel8.img: kernel8.elf
$(TOOLPREFIX)objcopy -O binary $< $@
kernel8.asm: kernel8.elf
$(TOOLPREFIX)objdump -d $< > $@
QEMU=qemu-system-aarch64
QEMUOPTS=-M raspi3b \
-display none \
-kernel kernel8.img \
-serial stdio
qemu: kernel8.img
$(QEMU) $(QEMUOPTS)
qemu-gdb: kernel8.img
@echo "use 'make gdb' in another terminal"
$(QEMU) $(QEMUOPTS) -S -s
gdb: kernel8.elf
$(TOOLPREFIX)gdb kernel8.elf
clean:
@rm -f kernel8.elf kernel8.img kernel8.asm *.o