blob: ee2769519eaf189804ddba6f7fd66a1b3b55eb74 [file] [log] [blame]
Chris Zankel8e1a6dd2005-06-23 22:01:10 -07001#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 2001 - 2005 Tensilica Inc.
Max Filippov420ae952014-06-16 07:25:06 +04007# Copyright (C) 2014 Cadence Design Systems Inc.
Chris Zankel8e1a6dd2005-06-23 22:01:10 -07008#
9# This file is included by the global makefile so that you can add your own
Masahiro Yamada8212f892021-10-13 15:36:22 +090010# architecture-specific flags and dependencies.
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070011
12# Core configuration.
Chris Zankel173d6682006-12-10 02:18:48 -080013# (Use VAR=<xtensa_config> to use another default compiler.)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070014
Masahiro Yamada129ab0d2021-12-14 11:53:53 +090015variant-y := $(CONFIG_XTENSA_VARIANT_NAME)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070016
Chris Zankel173d6682006-12-10 02:18:48 -080017VARIANT = $(variant-y)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070018
Geert Uytterhoeven70cefe72012-05-12 22:39:08 +020019ifneq ($(VARIANT),)
Masahiro Yamada23243c12021-05-02 02:24:36 +090020 ifdef cross_compiling
Geert Uytterhoeven70cefe72012-05-12 22:39:08 +020021 ifndef CROSS_COMPILE
22 CROSS_COMPILE = xtensa_$(VARIANT)-
23 endif
24 endif
25endif
26
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070027# Platform configuration
28
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070029platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
30platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
Max Filippov0d456ba2012-11-05 07:37:14 +040031platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070032
Chris Zankelb2444d32007-08-04 09:23:54 -070033# temporarily until string.h is fixed
Max Filippova753cd92012-09-17 05:44:51 +040034KBUILD_CFLAGS += -ffreestanding -D__linux__
Max Filippovf8f02ca2017-12-03 20:55:35 -080035KBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
Chris Zankelcf1c0aa2010-05-02 01:00:22 -070036KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
Max Filippov7bf52342017-04-28 09:40:00 -070037KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
Chris Zankelcf1c0aa2010-05-02 01:00:22 -070038
Max Filippovf8f02ca2017-12-03 20:55:35 -080039KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
40
Chris Zankel65501622012-11-13 15:16:36 -080041ifneq ($(CONFIG_LD_NO_RELAX),)
Masahiro Yamadad503ac52018-08-24 08:20:39 +090042KBUILD_LDFLAGS := --no-relax
Chris Zankel65501622012-11-13 15:16:36 -080043endif
44
Masahiro Yamadac425c542021-03-13 21:23:41 +090045CHECKFLAGS += -D$(if $(CONFIG_CPU_BIG_ENDIAN),__XTENSA_EB__,__XTENSA_EL__)
Max Filippov72100ed2012-12-11 01:26:25 +040046
Chris Zankel367b8112008-11-06 06:40:46 -080047vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
48plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
49
Chris Zankel367b8112008-11-06 06:40:46 -080050KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
Chris Zankel367b8112008-11-06 06:40:46 -080051
Chris Zankele7d163f2005-06-30 02:58:59 -070052KBUILD_DEFCONFIG := iss_defconfig
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070053
Chris Zankelf1933182009-04-02 16:58:53 -070054# Find libgcc.a
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070055
Sam Ravnborga0f97e02007-10-14 22:21:35 +020056LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070057
58head-y := arch/xtensa/kernel/head.o
Chris Zankelf1933182009-04-02 16:58:53 -070059
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070060libs-y += arch/xtensa/lib/ $(LIBGCC)
61
Chris Zankele7d163f2005-06-30 02:58:59 -070062boot := arch/xtensa/boot
63
Max Filippov7af710d2017-01-03 17:57:51 -080064all Image zImage uImage xipImage: vmlinux
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070065 $(Q)$(MAKE) $(build)=$(boot) $@
66
Firoz Khan5eacadb2018-11-13 15:49:30 +053067archheaders:
68 $(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
69
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070070define archhelp
Max Filippov9a736fc2016-12-25 04:58:57 -080071 @echo '* Image - Kernel ELF image with reset vector'
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070072 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
Max Filippov9a736fc2016-12-25 04:58:57 -080073 @echo '* uImage - U-Boot wrapped image'
Max Filippov7af710d2017-01-03 17:57:51 -080074 @echo ' xipImage - XIP image'
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070075endef