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 "-gdwarf-4", 13 "-O2", 14 15 "-Wall", 16 "-Wextra", 17 "-Wpedantic", 18 "-Werror", 19 20 # Extra warnings that are not included in `-Wall`, `-Wextra`, or `-Wpedantic`: 21 "-Wshift-sign-overflow", 22 "-Wimplicit-fallthrough", 23 "-fstack-protector-all", 24 ] 25 26 cflags_c = [ "-std=c23" ] 27 28 cflags_cc = [ 29 "-std=c++20", 30 "-Wno-extra", 31 ] 32} 33 34# Platform configuration. 35config("platform") { 36 assert( 37 plat_partition_max_memory_regions > 0 && 38 plat_partition_max_memory_regions < 65536, 39 "Maximum SP memory regions must be between 1 and 65535: current = ${plat_partition_max_memory_regions}") 40 assert( 41 plat_partition_max_device_regions > 0 && 42 plat_partition_max_device_regions < 65536, 43 "Maximum SP device regions must be between 1 and 65535: current = ${plat_partition_max_device_regions}") 44 assert( 45 plat_partition_max_dma_devices > 0 && plat_partition_max_dma_devices < 64, 46 "Maximum SP DMA devices must be between 1 and 64: current = ${plat_partition_max_dma_devices}") 47 assert( 48 plat_partition_max_dma_devices < plat_partition_max_device_regions, 49 "Maximum SP DMA devices must be less than device regions: current = ${plat_partition_max_dma_devices}") 50 assert( 51 plat_partition_max_intr_per_device > 0 && 52 plat_partition_max_intr_per_device < 256, 53 "Maximum interrupts per device regions must be between 1 and 255: current = ${plat_partition_max_intr_per_device}") 54 assert( 55 plat_partition_max_streams_per_device > 0 && 56 plat_partition_max_streams_per_device < 256, 57 "Maximum streams per device regions must be between 1 and 255: current = ${plat_partition_max_streams_per_device}") 58 59 assert( 60 plat_num_virtual_interrupts_ids > 0 && 61 plat_num_virtual_interrupts_ids <= 5120, 62 "Maximum virtual interrupt ids per vcpu must be between 1 and 5120: current = ${plat_num_virtual_interrupts_ids}") 63 64 include_dirs = [ 65 "//inc", 66 "//inc/vmapi", 67 "//src/arch/${plat_arch}/inc", 68 69 # Auto-generated headers using the 'offset_size_header' build rule. 70 "${root_gen_dir}/offset_size_header", 71 ] 72 73 defines = [ 74 "HEAP_PAGES=${plat_heap_pages}", 75 "MAX_CPUS=${plat_max_cpus}", 76 "MAX_VMS=${plat_max_vms}", 77 "LOG_LEVEL=${plat_log_level}", 78 "ENABLE_ASSERTIONS=${enable_assertions}", 79 "PARTITION_MAX_UUIDS=${plat_partition_max_uuids}", 80 "PARTITION_MAX_MEMORY_REGIONS=${plat_partition_max_memory_regions}", 81 "PARTITION_MAX_DEVICE_REGIONS=${plat_partition_max_device_regions}", 82 "PARTITION_MAX_DMA_DEVICES=${plat_partition_max_dma_devices}", 83 "PARTITION_MAX_INTERRUPTS_PER_DEVICE=${plat_partition_max_intr_per_device}", 84 "PARTITION_MAX_STREAMS_PER_DEVICE=${plat_partition_max_streams_per_device}", 85 "HF_NUM_INTIDS=${plat_num_virtual_interrupts_ids}", 86 ] 87 88 if (ffa_version != "") { 89 defines += [ "FFA_VERSION=${ffa_version}" ] 90 } 91} 92