-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (48 loc) · 1.45 KB
/
Makefile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
FIND_EXCLUDE_ARG := -not -path './build/*'
SRC_FILES := $(shell find . -name '*.c' $(FIND_EXCLUDE_ARG))
HEADER_FILES := $(shell find . -name '*.h' $(FIND_EXCLUDE_ARG))
ALL_FILES := $(SRC_FILES) $(HEADER_FILES)
CLANG_FORMAT := clang-format
ARCH := aarch64
all:
ninja -C build
rust-objcopy --binary-architecture=aarch64 build/byteos \
--strip-all -O binary build/byteos.bin
# format all code *.cpp *.h
fmt:
@$(CLANG_FORMAT) -i -style=file $(ALL_FILES)
@echo "All files have been formatted."
fdt:
@qemu-system-$(ARCH) -M 128m -machine virt,dumpdtb=virt.out
fdtdump virt.out
show-files:
@echo "Source files: $(SRC_FILES)"
@echo "Header files: $(HEADER_FILES)"
@echo "All files: $(ALL_FILES)"
clean:
rm build/byteos.bin
ninja -C build clean
run:
qemu-system-$(ARCH) \
-machine virt \
-cpu cortex-a72 \
-kernel build/byteos.bin \
-nographic \
-D qemu.log \
-d in_asm,int,pcall,cpu_reset,guest_errors
cmake:
cmake -B build -S . -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=on
gdb_server:
qemu-system-$(ARCH) \
-cpu cortex-a72 \
-machine virt \
-kernel build/byteos.bin \
-nographic \
-D qemu.log \
-d in_asm,int,pcall,cpu_reset,guest_errors -s -S
debug: build
@tmux new-session -d \
"ninja -C build run && echo '按任意键继续' && read -n 1" && \
tmux split-window -h "gdb build/byteos -ex 'target remote localhost:1234' -ex 'disp /16i $pc' " && \
tmux -2 attach-session -d
.PHONY: all fmt show-files clean run cmake gdb_server debug