Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (54 loc) · 1.93 KB
/
Copy pathMakefile
File metadata and controls
69 lines (54 loc) · 1.93 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
65
66
67
68
69
#
# Makefile for CS 452 kernel
#
XDIR=/u/cs452/public/xdev
XBINDIR=$(XDIR)/bin
XLIBDIR1=$(XDIR)/arm-none-eabi/lib
XLIBDIR2=$(XDIR)/lib/gcc/arm-none-eabi/9.2.0
STDCXX_INCLUDE_DIR=$(XDIR)/arm-none-eabi/include/c++/9.2.0/
CC = $(XBINDIR)/arm-none-eabi-gcc
CXX = $(XBINDIR)/arm-none-eabi-g++
AR = $(XBINDIR)/arm-none-eabi-ar
AS = $(XBINDIR)/arm-none-eabi-as
LD = $(XBINDIR)/arm-none-eabi-ld
# C preprocessor flags
CPPFLAGS = -I./include -I./user/include -I./track/include -I./calibration/include -MMD -MP
# C++ compiler flags
# -g: include debug information for gdb
# -S: only compile and emit assembly
# -fPIC: emit position-independent code
# -Wall: report all warnings
# -mcpu=arm920t: generate code for the 920t architecture
# -msoft-float: no FP co-processor
CXXFLAGS = -g -fPIC -Wall -mcpu=arm920t -msoft-float -fno-rtti -fno-exceptions -O3
CXXFLAGS += -DENABLE_DISPLAY=1 -DENABLE_OPT=1 -DENABLE_CACHE=1 -DSENDER_FIRST=0 -DRESERVATION_VERBOSE=0
# c: create archive, if necessary
# r: insert with replacement
# s: add index to archive
ARFLAGS = crs
# -static: force static linking
# -e: set entry point
# -nmagic: no page alignment
# -T: use linker script
LDFLAGS = -static -e main -nmagic -T linker.ld -L ./lib -L $(XLIBDIR2) -L $(XLIBDIR1)
LDLIBS = -lstdc++ -lc -lgcc
CXXSRC := $(shell find . -path './test' -prune -o -name '*.cc' -print)
ASMSRC := $(shell find . -name '*.S')
all: calibration/include/train_data.h kern/kmain.elf
calibration/include/train_data.h: ./calibration/data/trains.json
./calibration/calib_gen.py $^ $@
kern/kmain.elf: $(CXXSRC:%.cc=%.o) $(ASMSRC:%.S=%.o)
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-include $(CXXSRC:%.cc=%.d) $(ASMSRC:%.S=%.d)
.PHONY: clean
clean:
-find . -name '*.o' -delete
-find . -name '*.d' -delete
-find . -name '*.elf' -delete
-rm calibration/include/train_data.h
.PHONY: install
install: all
install kern/kmain.elf /u/cs452/tftp/ARM/$(USER)
.PHONY: uninstall
uninstall:
-rm /u/cs452/tftp/ARM/$(USER)/kmain.elf