annotate src/makefile-armgcc4.8.5 @ 12:ad95e7f82f1e

gcc-arm
author mir3636
date Fri, 16 Feb 2018 17:24:12 +0900
parents src/Makefile@83c23a36980d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # specify path to QEMU, installed with MacPorts
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 QEMU = qemu-system-arm
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 include makefile.inc
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
12
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
6 CC = arm-linux-gnu-gcc
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
7 AS = arm-linux-gnu-as
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
8 LD = arm-linux-gnu-ld
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
9 OBJCOPY = arm-linux-gnu-objcopy
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
10 OBJDUMP = arm-linux-gnu-objdump
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
11
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
12 CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
13
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
14 ASFLAGS =
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
15
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
16 LIBGCC = $(shell $(CC) -print-libgcc-file-name)
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
17
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
18 LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
19 -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@")
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
20
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
21 LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
22 $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@")
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
23 OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
24 -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@")
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
25
ad95e7f82f1e gcc-arm
mir3636
parents: 0
diff changeset
26
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 # link the libgcc.a for __aeabi_idiv. ARM has no native support for div
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 LIBS = $(LIBGCC)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 OBJS = \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 lib/string.o \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 arm.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 asm.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 bio.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 buddy.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 console.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 exec.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 file.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 fs.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 log.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 main.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 memide.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 pipe.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 proc.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 spinlock.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 start.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 swtch.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 syscall.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 sysfile.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 sysproc.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 trap_asm.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 trap.o\
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 vm.o \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 device/picirq.o \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 device/timer.o \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 device/uart.o
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 KERN_OBJS = $(OBJS) entry.o
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 kernel.elf: $(addprefix build/,$(KERN_OBJS)) kernel.ld build/initcode build/fs.img
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 cp -f build/initcode initcode
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 cp -f build/fs.img fs.img
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 $(call LINK_BIN, kernel.ld, kernel.elf, \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 $(addprefix build/,$(KERN_OBJS)), \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 initcode fs.img)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 $(OBJDUMP) -S kernel.elf > kernel.asm
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 $(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 rm -f initcode fs.img
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 qemu: kernel.elf
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 @clear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 $(QEMU) -M versatilepb -m 128 -cpu arm1176 -nographic -kernel kernel.elf
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 INITCODE_OBJ = initcode.o
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 $(addprefix build/,$(INITCODE_OBJ)): initcode.S
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 $(call build-directory)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 $(call AS_WITH, -nostdinc -I.)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 #initcode is linked into the kernel, it will be used to craft the first process
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 build/initcode: $(addprefix build/,$(INITCODE_OBJ))
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 $(call LINK_INIT, -N -e start -Ttext 0)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 $(call OBJCOPY_INIT)
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 $(OBJDUMP) -S $< > initcode.asm
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 build/fs.img:
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 make -C tools
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 make -C usr
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 clean:
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 rm -rf build
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 make -C tools clean
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 make -C usr clean