1*5f8ffb5fSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\" 2*5f8ffb5fSMichal Simek 3*5f8ffb5fSMichal Simek# What CPU vesion are we building for, and crack it open 4*5f8ffb5fSMichal Simek# as major.minor.rev 5*5f8ffb5fSMichal SimekCPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) ) 6*5f8ffb5fSMichal SimekCPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1) 7*5f8ffb5fSMichal SimekCPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2) 8*5f8ffb5fSMichal SimekCPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3) 9*5f8ffb5fSMichal Simek 10*5f8ffb5fSMichal Simekexport CPU_VER CPU_MAJOR CPU_MINOR CPU_REV 11*5f8ffb5fSMichal Simek 12*5f8ffb5fSMichal Simek# Use cpu-related CONFIG_ vars to set compile options. 13*5f8ffb5fSMichal Simek 14*5f8ffb5fSMichal Simek# Work out HW multipler support. This is icky. 15*5f8ffb5fSMichal Simek# 1. Spartan2 has no HW multiplers. 16*5f8ffb5fSMichal Simek# 2. MicroBlaze v3.x always uses them, except in Spartan 2 17*5f8ffb5fSMichal Simek# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings 18*5f8ffb5fSMichal Simekifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY))) 19*5f8ffb5fSMichal Simek ifeq ($(CPU_MAJOR),3) 20*5f8ffb5fSMichal Simek CPUFLAGS-1 += -mno-xl-soft-mul 21*5f8ffb5fSMichal Simek else 22*5f8ffb5fSMichal Simek # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support. 23*5f8ffb5fSMichal Simek CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high 24*5f8ffb5fSMichal Simek CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul 25*5f8ffb5fSMichal Simek endif 26*5f8ffb5fSMichal Simekendif 27*5f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div 28*5f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift 29*5f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP) += -mxl-pattern-compare 30*5f8ffb5fSMichal Simek 31*5f8ffb5fSMichal SimekCPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) 32*5f8ffb5fSMichal Simek 33*5f8ffb5fSMichal Simek# The various CONFIG_XILINX cpu features options are integers 0/1/2... 34*5f8ffb5fSMichal Simek# rather than bools y/n 35*5f8ffb5fSMichal SimekCFLAGS += $(CPUFLAGS-1) 36*5f8ffb5fSMichal SimekCFLAGS += $(CPUFLAGS-2) 37*5f8ffb5fSMichal Simek 38*5f8ffb5fSMichal Simek# r31 holds current when in kernel mode 39*5f8ffb5fSMichal SimekCFLAGS += -ffixed-r31 40*5f8ffb5fSMichal Simek 41*5f8ffb5fSMichal SimekLDFLAGS_BLOB := --format binary --oformat elf32-microblaze 42*5f8ffb5fSMichal Simek 43*5f8ffb5fSMichal SimekLIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 44*5f8ffb5fSMichal Simek 45*5f8ffb5fSMichal Simekhead-y := arch/microblaze/kernel/head.o 46*5f8ffb5fSMichal Simeklibs-y += arch/microblaze/lib/ $(LIBGCC) 47*5f8ffb5fSMichal Simekcore-y += arch/microblaze/kernel/ arch/microblaze/mm/ \ 48*5f8ffb5fSMichal Simek arch/microblaze/platform/ 49*5f8ffb5fSMichal Simek 50*5f8ffb5fSMichal Simekboot := arch/$(ARCH)/boot 51*5f8ffb5fSMichal Simek 52*5f8ffb5fSMichal Simek# defines filename extension depending memory management type 53*5f8ffb5fSMichal Simekifeq ($(CONFIG_MMU),) 54*5f8ffb5fSMichal SimekMMUEXT := -nommu 55*5f8ffb5fSMichal Simekendif 56*5f8ffb5fSMichal Simekexport MMUEXT 57*5f8ffb5fSMichal Simek 58*5f8ffb5fSMichal Simekall: linux.bin 59*5f8ffb5fSMichal Simek 60*5f8ffb5fSMichal Simekarchclean: 61*5f8ffb5fSMichal Simek $(Q)$(MAKE) $(clean)=$(boot) 62*5f8ffb5fSMichal Simek 63*5f8ffb5fSMichal Simeklinux.bin linux.bin.gz: vmlinux 64*5f8ffb5fSMichal Simek $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 65*5f8ffb5fSMichal Simek 66*5f8ffb5fSMichal Simekdefine archhelp 67*5f8ffb5fSMichal Simek echo '* linux.bin - Create raw binary' 68*5f8ffb5fSMichal Simek echo ' linux.bin.gz - Create compressed raw binary' 69*5f8ffb5fSMichal Simekendef 70