aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-09-07 11:54:53 +0200
committerBad Diode <bd@badd10de.dev>2021-09-07 11:54:53 +0200
commitd1e735682640c4f8ddedb0c699da33aa7f399426 (patch)
tree5f321d66fe74cb59378f880b2665f12f249a3ef2 /Makefile
parent4b86e6272166236c9283004f6a060d5174165796 (diff)
downloaduxnrpi-d1e735682640c4f8ddedb0c699da33aa7f399426.tar.gz
uxnrpi-d1e735682640c4f8ddedb0c699da33aa7f399426.zip
Add initial support for UART I/O
Resources: - https://github.com/bztsrc/raspi3-tutorial/tree/master/03_uart1 - https://www.youtube.com/watch?v=r3Ye08ktcMo
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 9 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 475c160..f531a02 100644
--- a/Makefile
+++ b/Makefile
@@ -3,17 +3,18 @@
3.PHONY: clean run 3.PHONY: clean run
4 4
5# Compiler. 5# Compiler.
6AS := arm-none-eabi-as 6AS := aarch64-elf-as
7CC := arm-none-eabi-gcc 7CC := aarch64-elf-gcc
8OBJCOPY := arm-none-eabi-objcopy 8LD := aarch64-elf-ld
9OBJCOPY := aarch64-elf-objcopy
9 10
10# Paths. 11# Paths.
11SRC_DIR := src 12SRC_DIR := src
12BUILD_DIR := build 13BUILD_DIR := build
13 14
14# Output files. 15# Output files.
15ELF := $(BUILD_DIR)/kernel7.elf 16ELF := $(BUILD_DIR)/kernel8.elf
16IMG := $(BUILD_DIR)/kernel7.img 17IMG := $(BUILD_DIR)/kernel8.img
17 18
18# Bootstrapping files. 19# Bootstrapping files.
19OBJ_START = $(BUILD_DIR)/start.o 20OBJ_START = $(BUILD_DIR)/start.o
@@ -22,6 +23,7 @@ SRC_LINK = $(SRC_DIR)/linker.ld
22 23
23CFLAGS := -Wall -ffreestanding -O2 -nostdlib -lgcc -mgeneral-regs-only 24CFLAGS := -Wall -ffreestanding -O2 -nostdlib -lgcc -mgeneral-regs-only
24AFLAGS := 25AFLAGS :=
26LDFLAGS :=
25 27
26default: $(IMG) 28default: $(IMG)
27 29
@@ -35,7 +37,7 @@ $(IMG): $(BUILD_DIR) $(ELF)
35 $(OBJCOPY) $(ELF) -O binary $(IMG) 37 $(OBJCOPY) $(ELF) -O binary $(IMG)
36 38
37$(ELF): $(OBJ_START) $(OBJ_MAIN) 39$(ELF): $(OBJ_START) $(OBJ_MAIN)
38 $(CC) $(CFLAGS) -T $(SRC_LINK) -o $(ELF) $(OBJ_START) $(OBJ_MAIN) 40 $(LD) $(LDFLAGS) -T $(SRC_LINK) -o $(ELF) $(OBJ_START) $(OBJ_MAIN)
39 41
40clean: 42clean:
41 rm -rf $(BUILD_DIR) 43 rm -rf $(BUILD_DIR)
@@ -44,4 +46,4 @@ $(BUILD_DIR):
44 mkdir -p $(BUILD_DIR) 46 mkdir -p $(BUILD_DIR)
45 47
46run: $(IMG) 48run: $(IMG)
47 qemu-system-aarch64 -M raspi3 -kernel $(IMG) -d in_asm -serial null -serial stdio 49 qemu-system-aarch64 -M raspi3 -kernel $(IMG) -serial null -serial stdio