14b2368ffSMichal Simekifeq ($(CONFIG_MMU),y) 24b2368ffSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" 34b2368ffSMichal Simekelse 45f8ffb5fSMichal SimekUTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\" 54b2368ffSMichal Simekendif 65f8ffb5fSMichal Simek 75f8ffb5fSMichal Simek# What CPU vesion are we building for, and crack it open 85f8ffb5fSMichal Simek# as major.minor.rev 9950b260eSSam RavnborgCPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER)) 10950b260eSSam RavnborgCPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1) 11950b260eSSam RavnborgCPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2) 12950b260eSSam RavnborgCPU_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. 17950b260eSSam Ravnborg# The various CONFIG_XILINX cpu features options are integers 0/1/2... 18950b260eSSam Ravnborg# rather than bools y/n 195f8ffb5fSMichal Simek 205f8ffb5fSMichal Simek# Work out HW multipler support. This is icky. 215f8ffb5fSMichal Simek# 1. Spartan2 has no HW multiplers. 225f8ffb5fSMichal Simek# 2. MicroBlaze v3.x always uses them, except in Spartan 2 235f8ffb5fSMichal Simek# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings 245f8ffb5fSMichal Simekifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY))) 255f8ffb5fSMichal Simek ifeq ($(CPU_MAJOR),3) 265f8ffb5fSMichal Simek CPUFLAGS-1 += -mno-xl-soft-mul 275f8ffb5fSMichal Simek else 285f8ffb5fSMichal Simek # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support. 295f8ffb5fSMichal Simek CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high 305f8ffb5fSMichal Simek CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul 315f8ffb5fSMichal Simek endif 325f8ffb5fSMichal Simekendif 335f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div 345f8ffb5fSMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift 3504e3a553SMichal SimekCPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare 365f8ffb5fSMichal Simek 375f8ffb5fSMichal SimekCPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) 385f8ffb5fSMichal Simek 395f8ffb5fSMichal Simek# r31 holds current when in kernel mode 40e469b0ebSJohn WilliamsKBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2) 415f8ffb5fSMichal Simek 42c3055d14SThomas ChouLDFLAGS := 43c3055d14SThomas ChouLDFLAGS_vmlinux := 445f8ffb5fSMichal Simek 45e469b0ebSJohn WilliamsLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 465f8ffb5fSMichal Simek 475f8ffb5fSMichal Simekhead-y := arch/microblaze/kernel/head.o 48950b260eSSam Ravnborglibs-y += arch/microblaze/lib/ 49950b260eSSam Ravnborglibs-y += $(LIBGCC) 50950b260eSSam Ravnborgcore-y += arch/microblaze/kernel/ 51950b260eSSam Ravnborgcore-y += arch/microblaze/mm/ 52950b260eSSam Ravnborgcore-y += arch/microblaze/platform/ 535f8ffb5fSMichal Simek 54950b260eSSam Ravnborgboot := arch/microblaze/boot 555f8ffb5fSMichal Simek 56*f05131cdSMichal Simek# Are we making a simpleImage.<boardname> target? If so, crack out the boardname 57*f05131cdSMichal SimekDTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS))) 58*f05131cdSMichal Simek 59*f05131cdSMichal Simekifneq ($(DTB),) 60*f05131cdSMichal Simek core-y += $(boot)/ 61*f05131cdSMichal Simekendif 62*f05131cdSMichal Simek 635f8ffb5fSMichal Simek# defines filename extension depending memory management type 645f8ffb5fSMichal Simekifeq ($(CONFIG_MMU),) 65950b260eSSam RavnborgMMU := -nommu 665f8ffb5fSMichal Simekendif 67950b260eSSam Ravnborg 68*f05131cdSMichal Simekexport MMU DTB 695f8ffb5fSMichal Simek 705f8ffb5fSMichal Simekall: linux.bin 715f8ffb5fSMichal Simek 72*f05131cdSMichal SimekBOOT_TARGETS = linux.bin linux.bin.gz simpleImage.% 73*f05131cdSMichal Simek 745f8ffb5fSMichal Simekarchclean: 755f8ffb5fSMichal Simek $(Q)$(MAKE) $(clean)=$(boot) 765f8ffb5fSMichal Simek 77*f05131cdSMichal Simek$(BOOT_TARGETS): vmlinux 785f8ffb5fSMichal Simek $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 795f8ffb5fSMichal Simek 805f8ffb5fSMichal Simekdefine archhelp 815f8ffb5fSMichal Simek echo '* linux.bin - Create raw binary' 825f8ffb5fSMichal Simek echo ' linux.bin.gz - Create compressed raw binary' 83*f05131cdSMichal Simek echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' 84*f05131cdSMichal Simek echo ' - stripped elf with fdt blob 85*f05131cdSMichal Simek echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob' 86*f05131cdSMichal Simek echo ' *_defconfig - Select default config from arch/microblaze/configs' 87*f05131cdSMichal Simek echo '' 88*f05131cdSMichal Simek echo ' Targets with <dt> embed a device tree blob inside the image' 89*f05131cdSMichal Simek echo ' These targets support board with firmware that does not' 90*f05131cdSMichal Simek echo ' support passing a device tree directly. Replace <dt> with the' 91*f05131cdSMichal Simek echo ' name of a dts file from the arch/microblaze/boot/dts/ directory' 92*f05131cdSMichal Simek echo ' (minus the .dts extension).' 935f8ffb5fSMichal Simekendef 94