]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/config.mk
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / arch / arm / config.mk
1 #
2 # (C) Copyright 2000-2002
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # SPDX-License-Identifier:      GPL-2.0+
6 #
7
8 ifeq ($(CROSS_COMPILE),)
9 CROSS_COMPILE := arm-linux-
10 endif
11
12 ifndef CONFIG_STANDALONE_LOAD_ADDR
13 ifneq ($(CONFIG_OMAP_COMMON),)
14 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
15 else
16 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
17 endif
18 endif
19
20 LDFLAGS_FINAL += --gc-sections
21 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
22                      -fno-common -ffixed-r9
23 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
24       $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
25
26 # Support generic board on ARM
27 __HAVE_ARCH_GENERIC_BOARD := y
28
29 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
30
31 # Choose between ARM/Thumb instruction sets
32 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
33 PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
34                         $(call cc-option,-marm,)\
35                         $(call cc-option,-mno-thumb-interwork,)\
36                 )
37 else
38 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
39                 $(call cc-option,-mno-thumb-interwork,)
40 endif
41
42 # Only test once
43 ifneq ($(CONFIG_SPL_BUILD),y)
44 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
45 archprepare: checkthumb
46
47 checkthumb:
48         @if test "$(call cc-version)" -lt "0404"; then \
49                 echo -n '*** Your GCC does not produce working '; \
50                 echo 'binaries in THUMB mode.'; \
51                 echo '*** Your board is configured for THUMB mode.'; \
52                 false; \
53         fi
54 endif
55 endif
56
57 # Try if EABI is supported, else fall back to old API,
58 # i. e. for example:
59 # - with ELDK 4.2 (EABI supported), use:
60 #       -mabi=aapcs-linux
61 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
62 #       -mabi=apcs-gnu
63 # - with ELDK 3.1 (gcc 3.x), use:
64 #       -mapcs-32
65 PF_CPPFLAGS_ABI := $(call cc-option,\
66                         -mabi=aapcs-linux,\
67                         $(call cc-option,\
68                                 -mapcs-32,\
69                                 $(call cc-option,\
70                                         -mabi=apcs-gnu,\
71                                 )\
72                         )\
73                 )
74 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
75
76 # For EABI, make sure to provide raise()
77 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
78 # This file is parsed many times, so the string may get added multiple
79 # times. Also, the prefix needs to be different based on whether
80 # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
81 # before adding the correct one.
82 PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
83         $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
84 endif
85
86 # needed for relocation
87 LDFLAGS_u-boot += -pie
88
89 #
90 # FIXME: binutils versions < 2.22 have a bug in the assembler where
91 # branches to weak symbols can be incorrectly optimized in thumb mode
92 # to a short branch (b.n instruction) that won't reach when the symbol
93 # gets preempted
94 #
95 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
96 #
97 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
98 ifeq ($(GAS_BUG_12532),)
99 export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
100         then echo y; else echo n; fi)
101 endif
102 ifeq ($(GAS_BUG_12532),y)
103 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
104 endif
105 endif
106
107 ifneq ($(CONFIG_SPL_BUILD),y)
108 # Check that only R_ARM_RELATIVE relocations are generated.
109 ALL-y += checkarmreloc
110 # The movt / movw can hardcode 16 bit parts of the addresses in the
111 # instruction. Relocation is not supported for that case, so disable
112 # such usage by requiring word relocations.
113 PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
114 endif
115
116 # limit ourselves to the sections we want in the .bin.
117 ifdef CONFIG_ARM64
118 OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
119 else
120 OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
121 endif
122
123 ifneq ($(CONFIG_IMX_CONFIG),)
124 ifdef CONFIG_SPL
125 ifndef CONFIG_SPL_BUILD
126 ALL-y += SPL
127 endif
128 else
129 ALL-y += u-boot.imx
130 endif
131 endif