-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·118 lines (103 loc) · 4.41 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
TARGET=mops.elf
BIN=mops.bin
LINKFILE=link.ld
KLAUSNAME=klaus
CC=arm-none-linux-gnueabi-gcc
AS=arm-none-linux-gnueabi-as
LD=arm-none-linux-gnueabi-ld
OBJCOPY=arm-none-linux-gnueabi-objcopy
RAMDISK=./ramdiskMaker.o $(1)
CCFLAGS= -O0 -c -mcpu=arm926ej-s -g -Iinclude/devices -Iinclude/system -I.
CCLINKFLAGS= -nostdlib -nodefaultlibs -nostartfiles
ASFLAGS=-mcpu=arm926ej-s -g
LDFLAGS=-T
OBJCOPYFLAGS=-O binary
ARMPATH=/usr/arm-none-linux-gnueabi/libc
RM=rm -f $(1)
all: $(TARGET)
$(OBJCOPY) $(OBJCOPYFLAGS) $(TARGET) $(BIN)
rebuild: clean all proc
###### Klaus stuff #####
procOBJS=klaus.o gunther.o scheduler.o
procBIN=scheduler.bin klaus.bin gunther.bin
procFILES=$(procBIN)
proc:$(procFILES)
$(call RAMDISK, $(procBIN))
scheduler.o: core/mops_scheduler.s
$(AS) $(ASFLAGS) core/mops_scheduler.s -o scheduler.o
scheduler.bin: scheduler.o
$(OBJCOPY) $(OBJCOPYFLAGS) scheduler.o scheduler.bin
#scheduler.o: core/scheduler/scheduler.c $(HEADERS)
# $(CC) -c -mcpu=arm926ej-s -Iinclude/system $(CCLINKFLAGS) core/scheduler/scheduler.c -o scheduler.o
# $(LD) $(LDFLAGS) link_schedule.ld scheduler.o core/mops_resume.o -o scheduler_test.o
#scheduler.bin: scheduler.o
# $(OBJCOPY) $(OBJCOPYFLAGS) scheduler_test.o scheduler.bin
klaus.o: klaus.c
$(CC) $(CCFLAGS) $(CCLINKFLAGS) klaus.c -o klaus.o
klaus.bin: klaus.o
$(OBJCOPY) $(OBJCOPYFLAGS) klaus.o klaus.bin
gunther.o: gunther.c
$(CC) $(CCFLAGS) $(CCLINKFLAGS) gunther.c -o gunther.o
gunther.bin: gunther.o
$(OBJCOPY) $(OBJCOPYFLAGS) gunther.o gunther.bin
###### Klaus Stuff #####
clean:
$(call RM, startup/*.o )
$(call RM, core/*.o )
$(call RM, core/syscalls/*.o)
$(call RM, core/devices/*.o )
$(call RM, core/scheduler/*.o )
OBJS=ramdisk.o startup/arm_irq.o \
core/mops_scheduler.o \
core/devices/p_vic.o \
core/devices/vic.o core/devices/timer.o core/devices/p_timer.o\
core/devices/uart.o core/devices/p_uart.o \
startup/vector_mapping.o startup/arm_init.o main.o \
startup/startup.o startup/initstacks.o core/scheduler/thread.o \
core/syscalls/syscalls.o core/mops_loader.o
HEADERS=include/devices/timer.h include/devices/uart.h \
include/system/arm_init.h include/system/arm_irq.h \
include/system/vic.h include/system/scheduler.h \
include/system/syscalls.h include/system/thread.h \
ramdisk.h include/system/mops_loader.h
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) $(LINKFILE) -o $(TARGET) $(OBJS)
ramdisk.o: ramdisk.c $(HEADERS)
$(CC) $(CCFLAGS) ramdisk.c -o ramdisk.o
main.o: main.c $(HEADERS)
$(CC) $(CCFLAGS) main.c -o main.o
startup/vector_mapping.o: startup/vector_mapping.c $(HEADERS)
$(CC) $(CCFLAGS) startup/vector_mapping.c -o startup/vector_mapping.o
startup/arm_init.o: startup/arm_init.c $(HEADERS)
$(CC) $(CCFLAGS) startup/arm_init.c -o startup/arm_init.o
core/devices/vic.o: core/devices/vic.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/vic.c -o core/devices/vic.o
core/devices/timer.o: core/devices/timer.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/timer.c -o core/devices/timer.o
core/devices/uart.o: core/devices/uart.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/uart.c -o core/devices/uart.o
core/devices/p_uart.o: core/devices/p_uart.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/p_uart.c -o core/devices/p_uart.o
core/devices/p_vic.o: core/devices/p_vic.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/p_vic.c -o core/devices/p_vic.o
core/devices/p_timer.o: core/devices/p_timer.c $(HEADERS)
$(CC) $(CCFLAGS) core/devices/p_timer.c -o core/devices/p_timer.o
#core/scheduler/scheduler.o: core/scheduler/scheduler.c $(HEADERS)
# $(CC) $(CCFLAGS) core/scheduler/scheduler.c -o core/scheduler/scheduler.o
core/syscalls/syscalls.o: core/syscalls/syscalls.c $(HEADERS)
$(CC) $(CCFLAGS) core/syscalls/syscalls.c -o core/syscalls/syscalls.o
core/scheduler/thread.o: core/scheduler/thread.c $(HEADERS)
$(CC) $(CCFLAGS) core/scheduler/thread.c -o core/scheduler/thread.o
core/mops_loader.o: core/mops_loader.c $(HEADERS)
$(CC) $(CCFLAGS) core/mops_loader.c -o core/mops_loader.o
# ASSEMBLER STUFF GOES HERE
startup/startup.o: startup/startup.s
$(AS) $(ASFLAGS) startup/startup.s -o startup/startup.o
startup/arm_irq.o: startup/arm_irq.s
$(AS) $(ASFLAGS) startup/arm_irq.s -o startup/arm_irq.o
startup/initstacks.o: startup/initstacks.s
$(AS) $(ASFLAGS) startup/initstacks.s -o startup/initstacks.o
core/mops_scheduler.o: core/mops_scheduler.s
$(AS) $(ASFLAGS) core/mops_scheduler.s -o core/mops_scheduler.o
#core/mops_resume.o: core/mops_resume.s
# $(AS) $(ASFLAGS) core/mops_resume.s -o core/mops_resume.o