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 toolprefix = "aarch64-none-elf-"
34 compiler = toolprefix ++ "gcc"
35 objcopy = toolprefix ++ "objcopy"
36 objdump = toolprefix ++ "objdump"
37 ar = toolprefix ++ "ar"
38 ranlib = toolprefix ++ "ranlib"
39 cxxcompiler = toolprefix ++ "g++"
41 ourCommonFlags = [ Str "-fno-unwind-tables",
42 Str "-Wno-packed-bitfield-compat",
43 Str "-fno-stack-protector",
44 Str "-mcpu=cortex-a57",
47 Str "-DPIC_REGISTER=X10",
50 Str "-DTHREAD_REGISTER=X9",
51 Str "-D__ARM_CORTEX__",
52 Str "-D__ARM_ARCH_8A__",
53 Str "-Wno-unused-but-set-variable",
57 cFlags = ArchDefaults.commonCFlags
58 ++ ArchDefaults.commonFlags
61 cxxFlags = ArchDefaults.commonCxxFlags
62 ++ ArchDefaults.commonFlags
65 cDefines = ArchDefaults.cDefines options
67 ourLdFlags = [ Str "-Wl,-section-start,.text=0x400000",
68 Str "-Wl,-section-start,.data=0x600000",
69 Str "-Wl,--build-id=none" ]
71 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
72 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
74 stdLibs = ArchDefaults.stdLibs arch ++ [ Str "-lgcc" ]
76 options = (ArchDefaults.options arch archFamily) {
78 optCxxFlags = cxxFlags,
79 optDefines = cDefines,
81 [ PreDep InstallTree arch "/include/trace_definitions/trace_defs.h",
82 PreDep InstallTree arch "/include/errors/errno.h",
83 PreDep InstallTree arch "/include/barrelfish_kpi/capbits.h",
84 PreDep InstallTree arch "/include/asmoffsets.h"
87 optLdCxxFlags = ldCxxFlags,
89 optInterconnectDrivers = ["lmp", "ump"],
90 optFlounderBackends = ["lmp", "ump"]
96 cCompiler = ArchDefaults.cCompiler arch compiler
97 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
98 makeDepend = ArchDefaults.makeDepend arch compiler
99 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
100 cToAssembler = ArchDefaults.cToAssembler arch compiler
101 assembler = ArchDefaults.assembler arch compiler
102 archive = ArchDefaults.archive arch
103 linker = ArchDefaults.linker arch compiler
104 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
108 -- The kernel is "different"
111 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
112 "-fno-unwind-tables",
122 "-Wstrict-prototypes",
123 "-Wold-style-definition",
124 "-Wmissing-prototypes",
125 "-Wmissing-declarations",
126 "-Wmissing-field-initializers",
129 "-imacros deputy/nodeputy.h",
132 "-fomit-frame-pointer",
133 "-Wmissing-noreturn",
135 "-DTHREAD_REGISTER=X9",
138 "-Wno-unused-but-set-variable",
142 kernelLdFlags = [ Str "-Wl,-N",
146 Str "-Wl,--fatal-warnings"
151 -- Link the kernel (CPU Driver)
153 linkKernel :: Options -> [String] -> [String] -> String -> HRule
154 linkKernel opts objs libs name =
155 let linkscript = "/kernel/" ++ name ++ ".lds"
156 kernelmap = "/kernel/" ++ name ++ ".map"
157 kasmdump = "/kernel/" ++ name ++ ".asm"
158 kbinary = "/sbin/" ++ name
159 kbootable = kbinary ++ ".bin"
161 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
162 NStr "-T", In BuildTree arch linkscript,
163 Str "-o", Out arch kbinary,
164 NStr "-Wl,-Map,", Out arch kernelmap
168 [ In BuildTree arch o | o <- objs ]
170 [ In BuildTree arch l | l <- libs ]
174 -- Generate kernel assembly dump
177 Str "-M reg-names-raw",
178 In BuildTree arch kbinary,
179 Str ">", Out arch kasmdump ],
181 NStr "-I", NoDep SrcTree "src" "/kernel/include/arch/armv8",
182 Str "-D__ASSEMBLER__",
183 Str "-P", In SrcTree "src" "/kernel/arch/armv8/linker.lds.in",