1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2010, ETH Zurich.
3 -- All rights reserved.
5 -- This file is distributed under the terms in the attached LICENSE file.
6 -- If you do not find this file, copies can be found by writing to:
7 -- ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
9 -- Architectural definitions for Barrelfish on ARMv5 ISA.
11 -- The build target is the integratorcp board on QEMU with the default
14 --------------------------------------------------------------------------
20 import qualified Config
21 import qualified ArchDefaults
23 -------------------------------------------------------------------------
25 -- Architecture specific definitions for ARM
27 -------------------------------------------------------------------------
30 archFamily = "aarch64"
32 compiler = "aarch64-apm-linux-gnu-gcc"
33 objcopy = "aarch64-apm-linux-gnu-objcopy"
34 objdump = "aarch64-apm-linux-gnu-objdump"
35 ar = "aarch64-apm-linux-gnu-ar"
36 ranlib = "aarch64-apm-linux-gnu-ranlib"
37 cxxcompiler = "aarch64-apm-linux-gnu-g++"
39 ourCommonFlags = [ Str "-fno-unwind-tables",
40 Str "-Wno-packed-bitfield-compat",
41 Str "-fno-stack-protector",
42 Str "-mcpu=cortex-a57",
45 Str "-DPIC_REGISTER=X10",
48 Str "-DTHREAD_REGISTER=X9",
49 Str "-D__ARM_CORTEX__",
50 Str "-D__ARM_ARCH_8A__",
51 Str "-Wno-unused-but-set-variable",
55 cFlags = ArchDefaults.commonCFlags
56 ++ ArchDefaults.commonFlags
59 cxxFlags = ArchDefaults.commonCxxFlags
60 ++ ArchDefaults.commonFlags
63 cDefines = ArchDefaults.cDefines options
65 ourLdFlags = [ Str "-Wl,-section-start,.text=0x400000",
66 Str "-Wl,-section-start,.data=0x600000",
67 Str "-Wl,--build-id=none" ]
69 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
70 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
72 stdLibs = ArchDefaults.stdLibs arch ++ [ Str "-lgcc" ]
74 options = (ArchDefaults.options arch archFamily) {
76 optCxxFlags = cxxFlags,
77 optDefines = cDefines,
79 [ PreDep InstallTree arch "/include/trace_definitions/trace_defs.h",
80 PreDep InstallTree arch "/include/errors/errno.h",
81 PreDep InstallTree arch "/include/barrelfish_kpi/capbits.h",
82 PreDep InstallTree arch "/include/asmoffsets.h"
85 optLdCxxFlags = ldCxxFlags,
87 optInterconnectDrivers = ["lmp", "ump"],
88 optFlounderBackends = ["lmp", "ump"]
94 cCompiler = ArchDefaults.cCompiler arch compiler
95 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
96 makeDepend = ArchDefaults.makeDepend arch compiler
97 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
98 cToAssembler = ArchDefaults.cToAssembler arch compiler
99 assembler = ArchDefaults.assembler arch compiler
100 archive = ArchDefaults.archive arch
101 linker = ArchDefaults.linker arch compiler
102 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
106 -- The kernel is "different"
109 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
110 "-fno-unwind-tables",
120 "-Wstrict-prototypes",
121 "-Wold-style-definition",
122 "-Wmissing-prototypes",
123 "-Wmissing-declarations",
124 "-Wmissing-field-initializers",
127 "-imacros deputy/nodeputy.h",
130 "-fomit-frame-pointer",
131 "-Wmissing-noreturn",
133 "-DTHREAD_REGISTER=X9",
136 "-Wno-unused-but-set-variable",
140 kernelLdFlags = [ Str "-Wl,-N",
144 Str "-Wl,--fatal-warnings"
149 -- Link the kernel (CPU Driver)
151 linkKernel :: Options -> [String] -> [String] -> String -> HRule
152 linkKernel opts objs libs name =
153 let linkscript = "/kernel/" ++ name ++ ".lds"
154 kernelmap = "/kernel/" ++ name ++ ".map"
155 kasmdump = "/kernel/" ++ name ++ ".asm"
156 kbinary = "/sbin/" ++ name
157 kbootable = kbinary ++ ".bin"
159 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
160 NStr "-T", In BuildTree arch linkscript,
161 Str "-o", Out arch kbinary,
162 NStr "-Wl,-Map,", Out arch kernelmap
166 [ In BuildTree arch o | o <- objs ]
168 [ In BuildTree arch l | l <- libs ]
172 -- Generate kernel assembly dump
175 Str "-M reg-names-raw",
176 In BuildTree arch kbinary,
177 Str ">", Out arch kasmdump ],
179 NStr "-I", NoDep SrcTree "src" "/kernel/include/arch/armv8",
180 Str "-D__ASSEMBLER__",
181 Str "-P", In SrcTree "src" "/kernel/arch/armv8/linker.lds.in",