config.mk 3.3 KB
Newer Older
W
wdenk 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# (C) Copyright 2000-2002
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#

24 25
CROSS_COMPILE ?= arm-linux-

26
ifndef CONFIG_STANDALONE_LOAD_ADDR
27
ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TI814X),)
28
CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
29
else
30
CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
31 32 33
endif
endif

34 35 36
LDFLAGS_FINAL += --gc-sections
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections

S
Simon Glass 已提交
37 38 39
# Support generic board on ARM
__HAVE_ARCH_GENERIC_BOARD := y

W
wdenk 已提交
40
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
41

A
Aneesh V 已提交
42 43 44 45 46 47 48 49 50 51
# Choose between ARM/Thumb instruction sets
ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
			$(call cc-option,-marm,)\
			$(call cc-option,-mno-thumb-interwork,)\
		)
else
PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
		$(call cc-option,-mno-thumb-interwork,)
endif
52

T
Tom Rini 已提交
53 54 55 56 57
# Only test once
ifneq ($(CONFIG_SPL_BUILD),y)
ALL-$(CONFIG_SYS_THUMB_BUILD)	+= checkthumb
endif

58 59 60
# Try if EABI is supported, else fall back to old API,
# i. e. for example:
# - with ELDK 4.2 (EABI supported), use:
A
Aneesh V 已提交
61
#	-mabi=aapcs-linux
62
# - with ELDK 4.1 (gcc 4.x, no EABI), use:
A
Aneesh V 已提交
63
#	-mabi=apcs-gnu
64
# - with ELDK 3.1 (gcc 3.x), use:
A
Aneesh V 已提交
65
#	-mapcs-32
W
Wolfgang Denk 已提交
66
PF_CPPFLAGS_ABI := $(call cc-option,\
A
Aneesh V 已提交
67
			-mabi=aapcs-linux,\
W
Wolfgang Denk 已提交
68 69
			$(call cc-option,\
				-mapcs-32,\
70
				$(call cc-option,\
W
Wolfgang Denk 已提交
71 72
					-mabi=apcs-gnu,\
				)\
A
Aneesh V 已提交
73
			)\
W
Wolfgang Denk 已提交
74 75
		)
PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
76 77 78

# For EABI, make sure to provide raise()
ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
A
Aneesh V 已提交
79 80 81 82 83 84 85 86 87 88
# This file is parsed many times, so the string may get added multiple
# times. Also, the prefix needs to be different based on whether
# CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
# before adding the correct one.
ifdef CONFIG_SPL_BUILD
PLATFORM_LIBS := $(SPLTREE)/arch/arm/lib/eabi_compat.o \
	$(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
else
PLATFORM_LIBS := $(OBJTREE)/arch/arm/lib/eabi_compat.o \
	$(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
89 90
endif
endif
A
Albert Aribaud 已提交
91 92

# needed for relocation
S
Stefano Babic 已提交
93
LDFLAGS_u-boot += -pie
A
Allen Martin 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111

#
# FIXME: binutils versions < 2.22 have a bug in the assembler where
# branches to weak symbols can be incorrectly optimized in thumb mode
# to a short branch (b.n instruction) that won't reach when the symbol
# gets preempted
#
# http://sourceware.org/bugzilla/show_bug.cgi?id=12532
#
ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
ifeq ($(GAS_BUG_12532),)
export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
	then echo y; else echo n; fi)
endif
ifeq ($(GAS_BUG_12532),y)
PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
endif
endif