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 62# Initialize PMCR.DP to 1 to prohibit cycle counting in secure state, and 63# save/restore PMCR during world switch. 64CFG_SM_NO_CYCLE_COUNTING ?= y 65 66ifeq ($(CFG_ARM32_core),y) 67# Configration directive related to ARMv7 optee boot arguments. 68# CFG_PAGEABLE_ADDR: if defined, forces pageable data physical address. 69# CFG_NS_ENTRY_ADDR: if defined, forces NS World physical entry address. 70# CFG_DT_ADDR: if defined, forces Device Tree data physical address. 71endif 72 73core-platform-cppflags += -I$(arch-dir)/include 74core-platform-subdirs += \ 75 $(addprefix $(arch-dir)/, kernel crypto mm tee pta) $(platform-dir) 76 77ifneq ($(CFG_WITH_ARM_TRUSTED_FW),y) 78core-platform-subdirs += $(arch-dir)/sm 79endif 80 81arm64-platform-cppflags += -DARM64=1 -D__LP64__=1 82arm32-platform-cppflags += -DARM32=1 -D__ILP32__=1 83 84platform-cflags-generic ?= -ffunction-sections -fdata-sections -pipe 85platform-aflags-generic ?= -pipe 86 87arm32-platform-cflags-no-hard-float ?= -mfloat-abi=soft 88arm32-platform-cflags-hard-float ?= -mfloat-abi=hard -funsafe-math-optimizations 89arm32-platform-cflags-generic ?= -mthumb -mthumb-interwork \ 90 -fno-short-enums -fno-common -mno-unaligned-access 91arm32-platform-aflags-no-hard-float ?= 92 93arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only 94arm64-platform-cflags-hard-float ?= 95arm64-platform-cflags-generic ?= -mstrict-align 96 97ifeq ($(DEBUG),1) 98# For backwards compatibility 99$(call force,CFG_CC_OPTIMIZE_FOR_SIZE,n) 100$(call force,CFG_DEBUG_INFO,y) 101endif 102 103CFG_CC_OPTIMIZE_FOR_SIZE ?= y 104ifeq ($(CFG_CC_OPTIMIZE_FOR_SIZE),y) 105platform-cflags-optimization ?= -Os 106else 107platform-cflags-optimization ?= -O0 108endif 109 110CFG_DEBUG_INFO ?= y 111ifeq ($(CFG_DEBUG_INFO),y) 112platform-cflags-debug-info ?= -g3 113platform-aflags-debug-info ?= -g 114endif 115 116core-platform-cflags += $(platform-cflags-optimization) 117core-platform-cflags += $(platform-cflags-generic) 118core-platform-cflags += $(platform-cflags-debug-info) 119 120core-platform-aflags += $(platform-aflags-generic) 121core-platform-aflags += $(platform-aflags-debug-info) 122 123ifeq ($(CFG_ARM64_core),y) 124arch-bits-core := 64 125core-platform-cppflags += $(arm64-platform-cppflags) 126core-platform-cflags += $(arm64-platform-cflags) 127core-platform-cflags += $(arm64-platform-cflags-generic) 128core-platform-cflags += $(arm64-platform-cflags-no-hard-float) 129core-platform-aflags += $(arm64-platform-aflags) 130else 131arch-bits-core := 32 132core-platform-cppflags += $(arm32-platform-cppflags) 133core-platform-cflags += $(arm32-platform-cflags) 134core-platform-cflags += $(arm32-platform-cflags-no-hard-float) 135ifeq ($(CFG_UNWIND),y) 136core-platform-cflags += -funwind-tables 137endif 138core-platform-cflags += $(arm32-platform-cflags-generic) 139core-platform-aflags += $(core_arm32-platform-aflags) 140core-platform-aflags += $(arm32-platform-aflags) 141endif 142 143ifneq ($(filter ta_arm32,$(ta-targets)),) 144# Variables for ta-target/sm "ta_arm32" 145CFG_ARM32_ta_arm32 := y 146arch-bits-ta_arm32 := 32 147ta_arm32-platform-cppflags += $(arm32-platform-cppflags) 148ta_arm32-platform-cflags += $(arm32-platform-cflags) 149ta_arm32-platform-cflags += $(platform-cflags-optimization) 150ta_arm32-platform-cflags += $(platform-cflags-debug-info) 151ta_arm32-platform-cflags += -fpie 152ta_arm32-platform-cflags += $(arm32-platform-cflags-generic) 153ifeq ($(platform-hard-float-enabled),y) 154ta_arm32-platform-cflags += $(arm32-platform-cflags-hard-float) 155else 156ta_arm32-platform-cflags += $(arm32-platform-cflags-no-hard-float) 157endif 158ifeq ($(CFG_UNWIND),y) 159ta_arm32-platform-cflags += -funwind-tables 160endif 161ta_arm32-platform-aflags += $(platform-aflags-generic) 162ta_arm32-platform-aflags += $(platform-aflags-debug-info) 163ta_arm32-platform-aflags += $(arm32-platform-aflags) 164 165ta-mk-file-export-vars-ta_arm32 += CFG_ARM32_ta_arm32 166ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cppflags 167ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cflags 168ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-aflags 169 170ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE ?= arm-linux-gnueabihf-_nl_ 171ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE32 ?= $$(CROSS_COMPILE)_nl_ 172ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE_ta_arm32 ?= $$(CROSS_COMPILE32)_nl_ 173endif 174 175ifneq ($(filter ta_arm64,$(ta-targets)),) 176# Variables for ta-target/sm "ta_arm64" 177CFG_ARM64_ta_arm64 := y 178arch-bits-ta_arm64 := 64 179ta_arm64-platform-cppflags += $(arm64-platform-cppflags) 180ta_arm64-platform-cflags += $(arm64-platform-cflags) 181ta_arm64-platform-cflags += $(platform-cflags-optimization) 182ta_arm64-platform-cflags += $(platform-cflags-debug-info) 183ta_arm64-platform-cflags += -fpie 184ta_arm64-platform-cflags += $(arm64-platform-cflags-generic) 185ifeq ($(platform-hard-float-enabled),y) 186ta_arm64-platform-cflags += $(arm64-platform-cflags-hard-float) 187else 188ta_arm64-platform-cflags += $(arm64-platform-cflags-no-hard-float) 189endif 190ta_arm64-platform-aflags += $(platform-aflags-generic) 191ta_arm64-platform-aflags += $(platform-aflags-debug-info) 192ta_arm64-platform-aflags += $(arm64-platform-aflags) 193 194ta-mk-file-export-vars-ta_arm64 += CFG_ARM64_ta_arm64 195ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cppflags 196ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cflags 197ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-aflags 198 199ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE64 ?= $$(CROSS_COMPILE)_nl_ 200ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE_ta_arm64 ?= $$(CROSS_COMPILE64)_nl_ 201endif 202 203# Set cross compiler prefix for each submodule 204$(foreach sm, core $(ta-targets), $(eval CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE$(arch-bits-$(sm))))) 205