1# Copyright 2018 The Hafnium Authors.
2#
3# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file or at
5# https://opensource.org/licenses/BSD-3-Clause.
6
7import("//build/toolchain/platform.gni")
8
9# Default language and error reporting configuration.
10config("compiler_defaults") {
11  cflags = [
12    "-g",
13    "-Wall",
14    "-O2",
15
16    #"-Wextra",
17    "-Wpedantic",
18    "-Werror",
19
20    "-fstack-protector-all",
21  ]
22
23  cflags_c = [ "-std=c11" ]
24
25  cflags_cc = [ "-std=c++2a" ]
26}
27
28# Platform configuration.
29config("platform") {
30  assert(
31      plat_partition_max_memory_regions > 0 &&
32          plat_partition_max_memory_regions < 65536,
33      "Maximum SP memory regions must be between 1 and 65535: current = ${plat_partition_max_memory_regions}")
34  assert(
35      plat_partition_max_device_regions > 0 &&
36          plat_partition_max_device_regions < 65536,
37      "Maximum SP device regions must be between 1 and 65535: current = ${plat_partition_max_device_regions}")
38  assert(
39      plat_partition_max_intr_per_device > 0 &&
40          plat_partition_max_intr_per_device < 256,
41      "Maximum interrupts per device regions must be between 1 and 255: current = ${plat_partition_max_intr_per_device}")
42  assert(
43      plat_partition_max_streams_per_device > 0 &&
44          plat_partition_max_streams_per_device < 256,
45      "Maximum streams per device regions must be between 1 and 255: current = ${plat_partition_max_streams_per_device}")
46
47  assert(
48      plat_num_virtual_interrupts_ids > 0 &&
49          plat_num_virtual_interrupts_ids < 5120,
50      "Maximum virtual interrupt ids per vcpu must be between 1 and 5119: current = ${plat_num_virtual_interrupts_ids}")
51
52  include_dirs = [
53    "//inc",
54    "//inc/vmapi",
55    "//src/arch/${plat_arch}/inc",
56
57    # Auto-generated headers using the 'offset_size_header' build rule.
58    "${root_gen_dir}/offset_size_header",
59  ]
60
61  defines = [
62    "HEAP_PAGES=${plat_heap_pages}",
63    "MAX_CPUS=${plat_max_cpus}",
64    "MAX_VMS=${plat_max_vms}",
65    "LOG_LEVEL=${plat_log_level}",
66    "ENABLE_ASSERTIONS=${enable_assertions}",
67    "PARTITION_MAX_MEMORY_REGIONS=${plat_partition_max_memory_regions}",
68    "PARTITION_MAX_DEVICE_REGIONS=${plat_partition_max_device_regions}",
69    "PARTITION_MAX_INTERRUPTS_PER_DEVICE=${plat_partition_max_intr_per_device}",
70    "PARTITION_MAX_STREAMS_PER_DEVICE=${plat_partition_max_streams_per_device}",
71    "HF_NUM_INTIDS=${plat_num_virtual_interrupts_ids}",
72  ]
73}
74