system: Remove CNTFRQ_EL0 write from arm64 boot
[gem5.git] / system / arm / bootloader / arm64 / makefile
1 # Copyright (c) 2019-2020 ARM Limited
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met: redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer;
8 # redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution;
11 # neither the name of the copyright holders nor the names of its
12 # contributors may be used to endorse or promote products derived from
13 # this software without specific prior written permission.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27 CROSS_COMPILE = aarch64-linux-gnu-
28 CC = $(CROSS_COMPILE)gcc
29 LD = $(CROSS_COMPILE)ld
30
31 .SUFFIXES:
32
33 BUILDDIR = .
34 DESTDIR = $(error Please set DESTDIR to wanted installation directory)
35
36 CFLAGS = -march=armv8-a
37 CPPFLAGS = -DPHYS_OFFSET=0x80000000 \
38 -DUART_BASE=0x1c090000 -DSYSREGS_BASE=0x1c010000 \
39 -Dkernel=0x80080000 \
40 -Dmbox=0x8000fff8 -Ddtb=0x80000100
41
42 LDFLAGS = -N -Ttext 0x00000010 -static
43
44 .PHONY: all clean install mkdir
45
46 all: mkdir $(BUILDDIR)/boot_emm.arm64 \
47 $(BUILDDIR)/boot.arm64 \
48 $(BUILDDIR)/boot_v2.arm64
49
50 #v1 has a GIC V2
51 $(BUILDDIR)/boot_emm.o: CPPFLAGS += -UGICV3 -DGIC_CPU_BASE=0x2c002000 \
52 -DGIC_DIST_BASE=0x2c001000
53 $(BUILDDIR)/boot.o: CPPFLAGS += -UGICV3 -DGIC_CPU_BASE=0x2c002000 \
54 -DGIC_DIST_BASE=0x2c001000
55
56 #V2 has a GIC V3
57 $(BUILDDIR)/boot_v2.o: CPPFLAGS += -DGICV3 -DGIC_REDIST_BASE=0x2c010000 \
58 -DGIC_DIST_BASE=0x2c000000
59
60 $(BUILDDIR)/%.arm64: $(BUILDDIR)/%.o
61 $(LD) -o $@ $< $(LDFLAGS)
62
63 $(BUILDDIR)/%.o: boot.S
64 $(CC) $(CPPFLAGS) -c $< -o $@ $(CFLAGS)
65
66 install:
67 mkdir -p $(DESTDIR)
68 install -m 644 $(BUILDDIR)/boot_emm.arm64 \
69 $(BUILDDIR)/boot.arm64 \
70 $(BUILDDIR)/boot_v2.arm64 \
71 $(DESTDIR)/.
72
73 mkdir:
74 mkdir -p $(BUILDDIR)
75
76 clean:
77 rm -f $(BUILDDIR)/*.o
78 rm -f $(BUILDDIR)/boot_emm.arm64 $(BUILDDIR)/boot.arm64 $(BUILDDIR)/boot_v2.arm64