-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (53 loc) · 1.83 KB
/
Makefile
File metadata and controls
64 lines (53 loc) · 1.83 KB
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
61
62
63
64
export
CROSS := riscv64-unknown-linux-gnu-
GCC := $(CROSS)gcc
LD := $(CROSS)ld
OBJCOPY := $(CROSS)objcopy
OBJDUMP := $(CROSS)objdump
ISA := rv64imafd
ABI := lp64
TEST_SCHED := 0
LOG := 1
INCLUDE := -I $(shell pwd)/include -I $(shell pwd)/arch/riscv/include
CF := -march=$(ISA) -mabi=$(ABI) -mcmodel=medany -fno-builtin -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nostdinc -static -lgcc -Wl,--nmagic -Wl,--gc-sections -g -fno-pie
CFLAG := $(CF) $(INCLUDE) -fno-stack-protector -DTEST_SCHED=$(TEST_SCHED) -DLOG=$(LOG)
.PHONY:all run debug clean
all: clean
$(MAKE) -C lib all
$(MAKE) -C init all
$(MAKE) -C user all
$(MAKE) -C fs all
$(MAKE) -C arch/riscv all
@echo -e '\n'Build Finished OK
run: all
@echo Launch qemu...
@qemu-system-riscv64 -nographic -machine virt -kernel vmlinux -bios default \
-global virtio-mmio.force-legacy=false \
-drive file=disk.img,if=none,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0
debug: all
@echo Launch qemu for debug...
@qemu-system-riscv64 -nographic -machine virt -kernel vmlinux -bios default \
-global virtio-mmio.force-legacy=false \
-drive file=disk.img,if=none,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 -S -s
clean:
$(MAKE) -C lib clean
$(MAKE) -C init clean
$(MAKE) -C user clean
$(MAKE) -C fs clean
$(MAKE) -C arch/riscv clean
$(shell test -f vmlinux && rm vmlinux)
$(shell test -f vmlinux.asm && rm vmlinux.asm)
$(shell test -f System.map && rm System.map)
@echo -e '\n'Clean Finished
SPIKE_CONFIG := .
spike_run: all
@echo Launch spike...
@spike --kernel=arch/riscv/boot/Image --real-time-clint $(SPIKE_CONFIG)/fw_jump.elf
spike_debug: all
@echo Launch spike for debug...
@spike --halted --rbb-port=9824 --kernel=arch/riscv/boot/Image ./fw_jump.elf
spike_bridge:
@echo Launch OpenOCD...
@openocd -f $(SPIKE_CONFIG)/openocd.cfg