1# SPDX-License-Identifier: GPL-2.0+
2#
3# (C) Copyright 2002-2006
4# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
6lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o \
7				    lib1funcs.o uldivmod.o div0.o \
8				    div64.o muldi3.o
9
10ifdef CONFIG_CPU_V7M
11obj-y	+= vectors_m.o crt0.o
12else ifdef CONFIG_ARM64
13obj-y	+= crt0_64.o
14else
15obj-y	+= vectors.o crt0.o
16endif
17
18ifdef CONFIG_ARM64
19obj-y   += setjmp_aarch64.o
20else
21obj-y   += setjmp.o
22endif
23
24ifndef CONFIG_SPL_BUILD
25ifdef CONFIG_ARM64
26obj-y	+= relocate_64.o
27else
28obj-y	+= relocate.o
29endif
30
31obj-$(CONFIG_CPU_V7M) += cmd_boot.o
32obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
33obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
34obj-$(CONFIG_CMD_BOOTM) += bootm.o
35obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
36obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
37else
38obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
39obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
40obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
41endif
42obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
43obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
44obj-$(CONFIG_SEMIHOSTING) += semihosting.o
45
46obj-y	+= bdinfo.o
47obj-y	+= sections.o
48CFLAGS_REMOVE_sections.o := $(LTO_CFLAGS)
49
50obj-y	+= stack.o
51ifdef CONFIG_CPU_V7M
52obj-y	+= interrupts_m.o
53else ifdef CONFIG_ARM64
54obj-$(CONFIG_FSL_LAYERSCAPE) += ccn504.o
55ifneq ($(CONFIG_GICV2)$(CONFIG_GICV3),)
56obj-y	+= gic_64.o
57endif
58obj-$(CONFIG_GIC_V3_ITS)	+= gic-v3-its.o
59obj-y	+= interrupts_64.o
60else
61obj-y	+= interrupts.o
62endif
63ifndef CONFIG_$(SPL_TPL_)SYSRESET
64obj-y	+= reset.o
65endif
66
67obj-y	+= cache.o
68obj-$(CONFIG_SYS_ARM_CACHE_CP15)	+= cache-cp15.o
69CFLAGS_REMOVE_cache-cp15.o := $(LTO_CFLAGS)
70
71obj-y	+= psci-dt.o
72
73obj-$(CONFIG_DEBUG_LL)	+= debug.o
74
75# For EABI conformant tool chains, provide eabi_compat()
76ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
77extra-y	+= eabi_compat.o
78endif
79
80# some files can only build in ARM or THUMB2, not THUMB1
81
82ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
83asflags-$(CONFIG_HAS_THUMB2) += -DCONFIG_THUMB2_KERNEL
84ifndef CONFIG_HAS_THUMB2
85
86# for C files, just apend -marm, which will override previous -mthumb*
87
88ifndef CONFIG_ARM64
89CFLAGS_cache.o := -marm
90CFLAGS_cache-cp15.o := -marm
91endif
92
93# For .S, drop -mthumb* and other thumb-related options.
94# CFLAGS_REMOVE_* would not have an effet, so AFLAGS_REMOVE_*
95# was implemented and is used here.
96# Also, define ${target}_NO_THUMB_BUILD for these two targets
97# so that the code knows it should not use Thumb.
98
99AFLAGS_REMOVE_memset.o := -mthumb -mthumb-interwork
100AFLAGS_REMOVE_memcpy.o := -mthumb -mthumb-interwork
101AFLAGS_memset.o := -DMEMSET_NO_THUMB_BUILD
102AFLAGS_memcpy.o := -DMEMCPY_NO_THUMB_BUILD
103endif
104endif
105
106# For building EFI apps
107CFLAGS_$(EFI_CRT0) := $(CFLAGS_EFI)
108CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI)
109
110CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI)
111CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI)
112
113extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC)
114# TODO: As of v2019.01 the relocation code for the EFI application cannot
115# be built on ARMv7-M.
116ifndef CONFIG_CPU_V7M
117#extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC)
118endif
119extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC)
120