xref: /linux/arch/microblaze/Makefile (revision 206d3642d8eea06ba23ff1d60b1452f9f57d0fe5)
18fad84c1SGeert UytterhoevenKBUILD_DEFCONFIG := mmu_defconfig
28fad84c1SGeert Uytterhoeven
34b2368ffSMichal Simekifeq ($(CONFIG_MMU),y)
44b2368ffSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
54b2368ffSMichal Simekelse
65f8ffb5fSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
74b2368ffSMichal Simekendif
85f8ffb5fSMichal Simek
95f8ffb5fSMichal Simek# What CPU vesion are we building for, and crack it open
105f8ffb5fSMichal Simek# as major.minor.rev
11950b260eSSam RavnborgCPU_VER   := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER))
12950b260eSSam RavnborgCPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
13950b260eSSam RavnborgCPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
14950b260eSSam RavnborgCPU_REV   := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
155f8ffb5fSMichal Simek
165f8ffb5fSMichal Simekexport CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
175f8ffb5fSMichal Simek
185f8ffb5fSMichal Simek# Use cpu-related CONFIG_ vars to set compile options.
19950b260eSSam Ravnborg# The various CONFIG_XILINX cpu features options are integers 0/1/2...
20950b260eSSam Ravnborg# rather than bools y/n
215f8ffb5fSMichal Simek
227f01af04SMichal Simek# Work out HW multipler support. This is tricky.
2325985edcSLucas De Marchi# 1. Spartan2 has no HW multipliers.
245f8ffb5fSMichal Simek# 2. MicroBlaze v3.x always uses them, except in Spartan 2
255f8ffb5fSMichal Simek# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
265f8ffb5fSMichal Simekifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
275f8ffb5fSMichal Simek  ifeq ($(CPU_MAJOR),3)
285f8ffb5fSMichal Simek    CPUFLAGS-1 += -mno-xl-soft-mul
295f8ffb5fSMichal Simek  else
30732bee7aSUwe Kleine-König    # USE_HW_MUL can be 0, 1, or 2, defining a hierarchy of HW Mul support.
315f8ffb5fSMichal Simek    CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
325f8ffb5fSMichal Simek    CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
335f8ffb5fSMichal Simek  endif
345f8ffb5fSMichal Simekendif
355f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
365f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
3704e3a553SMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
38*206d3642SBabu MogerCPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
39*206d3642SBabu MogerCPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian
405f8ffb5fSMichal Simek
415f8ffb5fSMichal SimekCPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
425f8ffb5fSMichal Simek
435f8ffb5fSMichal Simek# r31 holds current when in kernel mode
44e469b0ebSJohn WilliamsKBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
455f8ffb5fSMichal Simek
46c3055d14SThomas ChouLDFLAGS		:=
47c3055d14SThomas ChouLDFLAGS_vmlinux	:=
485f8ffb5fSMichal Simek
495f8ffb5fSMichal Simekhead-y := arch/microblaze/kernel/head.o
50950b260eSSam Ravnborglibs-y += arch/microblaze/lib/
51950b260eSSam Ravnborgcore-y += arch/microblaze/kernel/
52950b260eSSam Ravnborgcore-y += arch/microblaze/mm/
53a6475c13SMichal Simekcore-$(CONFIG_PCI) += arch/microblaze/pci/
545f8ffb5fSMichal Simek
553540ce82SJohn Williamsdrivers-$(CONFIG_OPROFILE) += arch/microblaze/oprofile/
563540ce82SJohn Williams
57950b260eSSam Ravnborgboot := arch/microblaze/boot
585f8ffb5fSMichal Simek
59f05131cdSMichal Simek# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
60f05131cdSMichal SimekDTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
61f05131cdSMichal Simek
62f05131cdSMichal Simekifneq ($(DTB),)
63300db34aSStephen Warren	core-y	+= $(boot)/dts/
64f05131cdSMichal Simekendif
65f05131cdSMichal Simek
665f8ffb5fSMichal Simek# defines filename extension depending memory management type
675f8ffb5fSMichal Simekifeq ($(CONFIG_MMU),)
68950b260eSSam RavnborgMMU := -nommu
695f8ffb5fSMichal Simekendif
70950b260eSSam Ravnborg
71f05131cdSMichal Simekexport MMU DTB
725f8ffb5fSMichal Simek
735f8ffb5fSMichal Simekall: linux.bin
745f8ffb5fSMichal Simek
755f8ffb5fSMichal Simekarchclean:
765f8ffb5fSMichal Simek	$(Q)$(MAKE) $(clean)=$(boot)
775f8ffb5fSMichal Simek
78ec2eba55SJason Wulinux.bin linux.bin.gz linux.bin.ub: vmlinux
79b843e4ecSThomas Backlund	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
805f5e3236SJason Wu
815f5e3236SJason WusimpleImage.%: vmlinux
825f8ffb5fSMichal Simek	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
835f8ffb5fSMichal Simek
845f8ffb5fSMichal Simekdefine archhelp
855f8ffb5fSMichal Simek  echo '* linux.bin    - Create raw binary'
865f8ffb5fSMichal Simek  echo '  linux.bin.gz - Create compressed raw binary'
87ec2eba55SJason Wu  echo '  linux.bin.ub - Create U-Boot wrapped raw binary'
88f05131cdSMichal Simek  echo '  simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
89699d17bcSArun Bhanu  echo '                   - stripped elf with fdt blob'
90f05131cdSMichal Simek  echo '  simpleImage.<dt>.unstrip - full ELF image with fdt blob'
91f05131cdSMichal Simek  echo '  *_defconfig      - Select default config from arch/microblaze/configs'
92f05131cdSMichal Simek  echo ''
93f05131cdSMichal Simek  echo '  Targets with <dt> embed a device tree blob inside the image'
94f05131cdSMichal Simek  echo '  These targets support board with firmware that does not'
95f05131cdSMichal Simek  echo '  support passing a device tree directly. Replace <dt> with the'
96f05131cdSMichal Simek  echo '  name of a dts file from the arch/microblaze/boot/dts/ directory'
97f05131cdSMichal Simek  echo '  (minus the .dts extension).'
985f8ffb5fSMichal Simekendef
998a8804f1SArun Bhanu
1008a8804f1SArun BhanuMRPROPER_FILES += $(boot)/simpleImage.*
101