xref: /linux/arch/microblaze/Makefile (revision 4b2368ffd6e3563b73b8391c133822a58b1b432a)
1*4b2368ffSMichal Simekifeq ($(CONFIG_MMU),y)
2*4b2368ffSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
3*4b2368ffSMichal Simekelse
45f8ffb5fSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
5*4b2368ffSMichal Simekendif
65f8ffb5fSMichal Simek
75f8ffb5fSMichal Simek# What CPU vesion are we building for, and crack it open
85f8ffb5fSMichal Simek# as major.minor.rev
95f8ffb5fSMichal SimekCPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) )
105f8ffb5fSMichal SimekCPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1)
115f8ffb5fSMichal SimekCPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2)
125f8ffb5fSMichal SimekCPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3)
135f8ffb5fSMichal Simek
145f8ffb5fSMichal Simekexport CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
155f8ffb5fSMichal Simek
165f8ffb5fSMichal Simek# Use cpu-related CONFIG_ vars to set compile options.
175f8ffb5fSMichal Simek
185f8ffb5fSMichal Simek# Work out HW multipler support.  This is icky.
195f8ffb5fSMichal Simek# 1. Spartan2 has no HW multiplers.
205f8ffb5fSMichal Simek# 2. MicroBlaze v3.x always uses them, except in Spartan 2
215f8ffb5fSMichal Simek# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
225f8ffb5fSMichal Simekifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
235f8ffb5fSMichal Simek  ifeq ($(CPU_MAJOR),3)
245f8ffb5fSMichal Simek    CPUFLAGS-1 += -mno-xl-soft-mul
255f8ffb5fSMichal Simek  else
265f8ffb5fSMichal Simek    # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support.
275f8ffb5fSMichal Simek    CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
285f8ffb5fSMichal Simek    CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
295f8ffb5fSMichal Simek  endif
305f8ffb5fSMichal Simekendif
315f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
325f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
3304e3a553SMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
345f8ffb5fSMichal Simek
355f8ffb5fSMichal SimekCPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
365f8ffb5fSMichal Simek
375f8ffb5fSMichal Simek# The various CONFIG_XILINX cpu features options are integers 0/1/2...
385f8ffb5fSMichal Simek# rather than bools y/n
395f8ffb5fSMichal Simek
405f8ffb5fSMichal Simek# r31 holds current when in kernel mode
41993ce240SMichal SimekCFLAGS_KERNEL += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
425f8ffb5fSMichal Simek
43c3055d14SThomas ChouLDFLAGS		:=
44c3055d14SThomas ChouLDFLAGS_vmlinux	:=
455f8ffb5fSMichal SimekLDFLAGS_BLOB := --format binary --oformat elf32-microblaze
465f8ffb5fSMichal Simek
47993ce240SMichal SimekLIBGCC := $(shell $(CC) $(CFLAGS_KERNEL) -print-libgcc-file-name)
485f8ffb5fSMichal Simek
495f8ffb5fSMichal Simekhead-y		:= arch/microblaze/kernel/head.o
505f8ffb5fSMichal Simeklibs-y		+= arch/microblaze/lib/ $(LIBGCC)
515f8ffb5fSMichal Simekcore-y		+= arch/microblaze/kernel/ arch/microblaze/mm/ \
525f8ffb5fSMichal Simek		   arch/microblaze/platform/
535f8ffb5fSMichal Simek
545f8ffb5fSMichal Simekboot := arch/$(ARCH)/boot
555f8ffb5fSMichal Simek
565f8ffb5fSMichal Simek# defines filename extension depending memory management type
575f8ffb5fSMichal Simekifeq ($(CONFIG_MMU),)
585f8ffb5fSMichal SimekMMUEXT		:= -nommu
595f8ffb5fSMichal Simekendif
605f8ffb5fSMichal Simekexport	MMUEXT
615f8ffb5fSMichal Simek
625f8ffb5fSMichal Simekall: linux.bin
635f8ffb5fSMichal Simek
645f8ffb5fSMichal Simekarchclean:
655f8ffb5fSMichal Simek	$(Q)$(MAKE) $(clean)=$(boot)
665f8ffb5fSMichal Simek
675f8ffb5fSMichal Simeklinux.bin linux.bin.gz: vmlinux
685f8ffb5fSMichal Simek	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
695f8ffb5fSMichal Simek
705f8ffb5fSMichal Simekdefine archhelp
715f8ffb5fSMichal Simek  echo  '* linux.bin    - Create raw binary'
725f8ffb5fSMichal Simek  echo  '  linux.bin.gz - Create compressed raw binary'
735f8ffb5fSMichal Simekendef
74