blob: d3069ae7ace0ade44d9db206f0908be4b1027fca [file] [log] [blame]
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/image/image.gni")
import("//build/toolchain/platform.gni")
# The hypervisor image.
hypervisor("hafnium") {
sources = [
"layout.c",
]
deps = [
":src_not_testable_yet",
]
}
# Hypervisor specific code that isn't. One day it will be testable and both the
# src targets will merge!
source_set("src_not_testable_yet") {
sources = [
"cpio.c",
"load.c",
"main.c",
"plat.c",
]
deps = [
":src_testable",
"//project/${project}/${plat_name}",
]
}
# One day, this will contain all the hypervisor's source but only once it can
# all be built against the fake arch for unit tests. Utilities that are shared
# e.g. with VM used in the VM tests have their own targets to facilitate
# sharing.
source_set("src_testable") {
sources = [
"api.c",
"cpu.c",
"fdt_handler.c",
"mm.c",
"mpool.c",
"vm.c",
]
deps = [
":common",
":fdt",
":memiter",
"//src/arch/${plat_arch}",
]
if (is_debug) {
deps += [ ":dlog" ]
}
}
# Code that is not specific to a certain image so can be shared.
source_set("common") {
sources = [
"std.c",
]
}
# Debug code that is not specific to a certain image so can be shared.
source_set("dlog") {
sources = [
"dlog.c",
]
deps = [
":common",
"//src/arch/${plat_arch}:putchar",
]
}
# Flattened Device Tree (FDT) utilities.
source_set("fdt") {
sources = [
"fdt.c",
]
deps = [
":common",
]
if (is_debug) {
deps += [ ":dlog" ]
}
}
source_set("memiter") {
sources = [
"memiter.c",
]
}
executable("unit_tests") {
testonly = true
sources = [
"abi_test.cc",
"api_test.cc",
"fdt_handler_test.cc",
"fdt_test.cc",
"mm_test.cc",
"mpool_test.cc",
]
sources += [ "layout_fake.c" ]
cflags_cc = [
"-Wno-c99-extensions",
"-Wno-nested-anon-types",
]
deps = [
":src_testable",
"//third_party:gtest_main",
]
}