1CFG_LTC_OPTEE_THREAD ?= y 2# Size of emulated TrustZone protected SRAM, 448 kB. 3# Only applicable when paging is enabled. 4CFG_CORE_TZSRAM_EMUL_SIZE ?= 458752 5CFG_LPAE_ADDR_SPACE_SIZE ?= (1ull << 32) 6 7CFG_MMAP_REGIONS ?= 13 8CFG_RESERVED_VASPACE_SIZE ?= (1024 * 1024 * 10) 9 10ifeq ($(CFG_ARM64_core),y) 11CFG_KERN_LINKER_FORMAT ?= elf64-littleaarch64 12CFG_KERN_LINKER_ARCH ?= aarch64 13else 14ifeq ($(CFG_ARM32_core),y) 15CFG_KERN_LINKER_FORMAT ?= elf32-littlearm 16CFG_KERN_LINKER_ARCH ?= arm 17else 18$(error Error: CFG_ARM64_core or CFG_ARM32_core should be defined) 19endif 20endif 21 22ifeq ($(CFG_TA_FLOAT_SUPPORT),y) 23# Use hard-float for floating point support in user TAs instead of 24# soft-float 25CFG_WITH_VFP ?= y 26ifeq ($(CFG_ARM64_core),y) 27# AArch64 has no fallback to soft-float 28$(call force,CFG_WITH_VFP,y) 29endif 30ifeq ($(CFG_WITH_VFP),y) 31platform-hard-float-enabled := y 32endif 33endif 34 35# Adds protection against CVE-2017-5715 also know as Spectre 36# (https://spectreattack.com) 37# See also https://developer.arm.com/-/media/Files/pdf/Cache_Speculation_Side-channels.pdf 38# Variant 2 39CFG_CORE_WORKAROUND_SPECTRE_BP ?= y 40# Same as CFG_CORE_WORKAROUND_SPECTRE_BP but targeting exceptions from 41# secure EL0 instead of non-secure world. 42CFG_CORE_WORKAROUND_SPECTRE_BP_SEC ?= $(CFG_CORE_WORKAROUND_SPECTRE_BP) 43 44CFG_CORE_RWDATA_NOEXEC ?= y 45CFG_CORE_RODATA_NOEXEC ?= n 46ifeq ($(CFG_CORE_RODATA_NOEXEC),y) 47$(call force,CFG_CORE_RWDATA_NOEXEC,y) 48endif 49# 'y' to set the Alignment Check Enable bit in SCTLR/SCTLR_EL1, 'n' to clear it 50CFG_SCTLR_ALIGNMENT_CHECK ?= y 51 52ifeq ($(CFG_CORE_LARGE_PHYS_ADDR),y) 53$(call force,CFG_WITH_LPAE,y) 54endif 55 56# Unmaps all kernel mode code except the code needed to take exceptions 57# from user space and restore kernel mode mapping again. This gives more 58# strict control over what is accessible while in user mode. 59# Addresses CVE-2017-5715 (aka Meltdown) known to affect Arm Cortex-A75 60CFG_CORE_UNMAP_CORE_AT_EL0 ?= y 61 62ifeq ($(CFG_ARM32_core),y) 63# Configration directive related to ARMv7 optee boot arguments. 64# CFG_PAGEABLE_ADDR: if defined, forces pageable data physical address. 65# CFG_NS_ENTRY_ADDR: if defined, forces NS World physical entry address. 66# CFG_DT_ADDR: if defined, forces Device Tree data physical address. 67endif 68 69core-platform-cppflags += -I$(arch-dir)/include 70core-platform-subdirs += \ 71 $(addprefix $(arch-dir)/, kernel crypto mm tee pta) $(platform-dir) 72 73ifneq ($(CFG_WITH_ARM_TRUSTED_FW),y) 74core-platform-subdirs += $(arch-dir)/sm 75endif 76 77arm64-platform-cppflags += -DARM64=1 -D__LP64__=1 78arm32-platform-cppflags += -DARM32=1 -D__ILP32__=1 79 80platform-cflags-generic ?= -ffunction-sections -fdata-sections -pipe 81platform-aflags-generic ?= -pipe 82 83arm32-platform-cflags-no-hard-float ?= -mfloat-abi=soft 84arm32-platform-cflags-hard-float ?= -mfloat-abi=hard -funsafe-math-optimizations 85arm32-platform-cflags-generic ?= -mthumb -mthumb-interwork \ 86 -fno-short-enums -fno-common -mno-unaligned-access 87arm32-platform-aflags-no-hard-float ?= 88 89arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only 90arm64-platform-cflags-hard-float ?= 91arm64-platform-cflags-generic ?= -mstrict-align 92 93ifeq ($(DEBUG),1) 94# For backwards compatibility 95$(call force,CFG_CC_OPTIMIZE_FOR_SIZE,n) 96$(call force,CFG_DEBUG_INFO,y) 97endif 98 99CFG_CC_OPTIMIZE_FOR_SIZE ?= y 100ifeq ($(CFG_CC_OPTIMIZE_FOR_SIZE),y) 101platform-cflags-optimization ?= -Os 102else 103platform-cflags-optimization ?= -O0 104endif 105 106CFG_DEBUG_INFO ?= y 107ifeq ($(CFG_DEBUG_INFO),y) 108platform-cflags-debug-info ?= -g3 109platform-aflags-debug-info ?= -g 110endif 111 112core-platform-cflags += $(platform-cflags-optimization) 113core-platform-cflags += $(platform-cflags-generic) 114core-platform-cflags += $(platform-cflags-debug-info) 115 116core-platform-aflags += $(platform-aflags-generic) 117core-platform-aflags += $(platform-aflags-debug-info) 118 119ifeq ($(CFG_ARM64_core),y) 120arch-bits-core := 64 121core-platform-cppflags += $(arm64-platform-cppflags) 122core-platform-cflags += $(arm64-platform-cflags) 123core-platform-cflags += $(arm64-platform-cflags-generic) 124core-platform-cflags += $(arm64-platform-cflags-no-hard-float) 125core-platform-aflags += $(arm64-platform-aflags) 126else 127arch-bits-core := 32 128core-platform-cppflags += $(arm32-platform-cppflags) 129core-platform-cflags += $(arm32-platform-cflags) 130core-platform-cflags += $(arm32-platform-cflags-no-hard-float) 131ifeq ($(CFG_UNWIND),y) 132core-platform-cflags += -funwind-tables 133endif 134core-platform-cflags += $(arm32-platform-cflags-generic) 135core-platform-aflags += $(core_arm32-platform-aflags) 136core-platform-aflags += $(arm32-platform-aflags) 137endif 138 139ifneq ($(filter ta_arm32,$(ta-targets)),) 140# Variables for ta-target/sm "ta_arm32" 141CFG_ARM32_ta_arm32 := y 142arch-bits-ta_arm32 := 32 143ta_arm32-platform-cppflags += $(arm32-platform-cppflags) 144ta_arm32-platform-cflags += $(arm32-platform-cflags) 145ta_arm32-platform-cflags += $(platform-cflags-optimization) 146ta_arm32-platform-cflags += $(platform-cflags-debug-info) 147ta_arm32-platform-cflags += -fpie 148ta_arm32-platform-cflags += $(arm32-platform-cflags-generic) 149ifeq ($(platform-hard-float-enabled),y) 150ta_arm32-platform-cflags += $(arm32-platform-cflags-hard-float) 151else 152ta_arm32-platform-cflags += $(arm32-platform-cflags-no-hard-float) 153endif 154ifeq ($(CFG_UNWIND),y) 155ta_arm32-platform-cflags += -funwind-tables 156endif 157ta_arm32-platform-aflags += $(platform-aflags-generic) 158ta_arm32-platform-aflags += $(platform-aflags-debug-info) 159ta_arm32-platform-aflags += $(arm32-platform-aflags) 160 161ta-mk-file-export-vars-ta_arm32 += CFG_ARM32_ta_arm32 162ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cppflags 163ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cflags 164ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-aflags 165 166ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE ?= arm-linux-gnueabihf-_nl_ 167ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE32 ?= $$(CROSS_COMPILE)_nl_ 168ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE_ta_arm32 ?= $$(CROSS_COMPILE32)_nl_ 169endif 170 171ifneq ($(filter ta_arm64,$(ta-targets)),) 172# Variables for ta-target/sm "ta_arm64" 173CFG_ARM64_ta_arm64 := y 174arch-bits-ta_arm64 := 64 175ta_arm64-platform-cppflags += $(arm64-platform-cppflags) 176ta_arm64-platform-cflags += $(arm64-platform-cflags) 177ta_arm64-platform-cflags += $(platform-cflags-optimization) 178ta_arm64-platform-cflags += $(platform-cflags-debug-info) 179ta_arm64-platform-cflags += -fpie 180ta_arm64-platform-cflags += $(arm64-platform-cflags-generic) 181ifeq ($(platform-hard-float-enabled),y) 182ta_arm64-platform-cflags += $(arm64-platform-cflags-hard-float) 183else 184ta_arm64-platform-cflags += $(arm64-platform-cflags-no-hard-float) 185endif 186ta_arm64-platform-aflags += $(platform-aflags-generic) 187ta_arm64-platform-aflags += $(platform-aflags-debug-info) 188ta_arm64-platform-aflags += $(arm64-platform-aflags) 189 190ta-mk-file-export-vars-ta_arm64 += CFG_ARM64_ta_arm64 191ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cppflags 192ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cflags 193ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-aflags 194 195ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE64 ?= $$(CROSS_COMPILE)_nl_ 196ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE_ta_arm64 ?= $$(CROSS_COMPILE64)_nl_ 197endif 198 199# Set cross compiler prefix for each submodule 200$(foreach sm, core $(ta-targets), $(eval CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE$(arch-bits-$(sm))))) 201