1ifndef ARCH_arm_TOOLCHAIN_INCLUDED 2ARCH_arm_TOOLCHAIN_INCLUDED := 1 3 4# try to find the toolchain 5ifndef ARCH_arm_TOOLCHAIN_PREFIX 6 7# if TOOLCHAIN_PREFIX is not empty, try to use it first 8ifneq ($(TOOLCHAIN_PREFIX),) 9ARCH_arm_TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREFIX) 10FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 11endif 12 13# try a series of common arm toolchain prefixes in the path 14ifeq ($(FOUNDTOOL),) 15ARCH_arm_TOOLCHAIN_PREFIX := arm-eabi- 16FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 17endif 18ifeq ($(FOUNDTOOL),) 19ARCH_arm_TOOLCHAIN_PREFIX := arm-elf- 20FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 21endif 22ifeq ($(FOUNDTOOL),) 23ARCH_arm_TOOLCHAIN_PREFIX := arm-none-eabi- 24FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 25endif 26ifeq ($(FOUNDTOOL),) 27ARCH_arm_TOOLCHAIN_PREFIX := arm-linux-gnueabi- 28FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 29 30# Set no stack protection if we found our gnueabi toolchain. We don't 31# need it. 32# 33# Stack protection is default in this toolchain and we get such errors 34# final linking stage: 35# 36# undefined reference to `__stack_chk_guard' 37# undefined reference to `__stack_chk_fail' 38# undefined reference to `__stack_chk_guard' 39# 40ifneq (,$(findstring arm-linux-gnueabi-,$(FOUNDTOOL))) 41 ARCH_arm_COMPILEFLAGS += -fno-stack-protector 42endif 43endif # arm-linux-gnueabi- 44 45else 46FOUNDTOOL=$(shell which $(ARCH_arm_TOOLCHAIN_PREFIX)gcc) 47endif # ARCH_arm_TOOLCHAIN_PREFIX 48 49ifeq ($(FOUNDTOOL),) 50$(warning cannot find toolchain in path, assuming arm-eabi- prefix) 51ARCH_arm_TOOLCHAIN_PREFIX := arm-eabi- 52endif 53 54ifeq ($(ARM_CPU),cortex-m0) 55ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 56ARCH_arm_COMPILEFLAGS += -mthumb -mfloat-abi=soft 57endif 58ifeq ($(ARM_CPU),cortex-m0plus) 59ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 60ARCH_arm_COMPILEFLAGS += -mthumb -mfloat-abi=soft 61endif 62ifeq ($(ARM_CPU),cortex-m3) 63ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 64endif 65ifeq ($(ARM_CPU),cortex-m4) 66ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 67endif 68ifeq ($(ARM_CPU),cortex-m55) 69ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 70endif 71ifeq ($(ARM_CPU),cortex-m7) 72# use cortex-m4 for now until better general toolchain support 73ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4 74endif 75ifeq ($(ARM_CPU),cortex-m7-fpu-sp-d16) 76# use cortex-m4 for now until better general toolchain support 77ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4 78ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=fpv4-sp-d16 -mfloat-abi=softfp 79endif 80ifeq ($(ARM_CPU),cortex-m4f) 81ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4 82ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=fpv4-sp-d16 -mfloat-abi=softfp 83endif 84ifeq ($(ARM_CPU),cortex-a7) 85ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 86ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=vfpv3 -mfloat-abi=softfp 87endif 88ifeq ($(ARM_CPU),cortex-a8) 89ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 90ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp 91endif 92ifeq ($(ARM_CPU),cortex-a9) 93ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 94endif 95ifeq ($(ARM_CPU),cortex-a9-neon) 96ARCH_arm_COMPILEFLAGS += -mcpu=cortex-a9 97ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp 98endif 99ifeq ($(ARM_CPU),cortex-a15) 100ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 101ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp 102endif 103ifeq ($(ARM_CPU),arm1136j-s) 104ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 105endif 106ifeq ($(ARM_CPU),arm1176jzf-s) 107ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 108endif 109ifeq ($(ARM_CPU),cortex-r4f) 110ARCH_arm_COMPILEFLAGS += -march=armv7-r 111ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU) 112ARCH_arm_COMPILEFLAGS += -mbig-endian 113ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=vfpv3-d16 -mfloat-abi=hard 114GLOBAL_MODULE_LDFLAGS += -EB 115endif 116ifeq ($(ARM_CPU),armemu) 117ARCH_arm_COMPILEFLAGS += -march=armv7-a 118endif 119 120endif 121