summaryrefslogtreecommitdiffstats
path: root/rules/pre
diff options
context:
space:
mode:
authorStephan Linz <linz@li-pro.net>2011-03-29 09:01:03 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2011-04-14 09:08:13 +0200
commit5dd27e8eb09c19d36686f8f09e93dc3563e78734 (patch)
tree4c3acd39f3f34ca87eb0753491da38f86e64dc80 /rules/pre
parentb583d35beb7c27164de336e8a32dca4e93992b2a (diff)
downloadptxdist-5dd27e8eb09c19d36686f8f09e93dc3563e78734.tar.gz
ptxdist-5dd27e8eb09c19d36686f8f09e93dc3563e78734.tar.xz
V3: add Xilinx MicroBlaze architecture
This is support for Xilinx MicroBlaze processors. MicroBlaze is a soft core processor designed for Xilinx FPGAs. With this new architecture ptxdist have to handle dynamic platform configurations exported by Xilinx design tools. Some essential changes and extensions inside a few ptxdist core scripts were made to merge external platform configurations into the ptxdist platform configuration. That is very important since the resulting build process have to know about the real CPU features like hardware multiplier, barrel shifter or similar high performance accelerators. So ptxdist knows about this specialty, parse the new platform directory "xlbsp" and use the content for its own platform configuration. The content of the new platform directory "xlbsp" comes from Xilinx design tools and have to be: * auto-config.in (Linux Kernel 2.4 configuration) * Kconfig.auto (Linux Kernel 2.6 configuration) * xilinx.dts (Linux Kernel 2.6 configuration) * config.mk (U-Boot configuration) * xparameters.h (U-Boot configuration) Signed-off-by: Stephan Linz <linz@li-pro.net> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'rules/pre')
-rw-r--r--rules/pre/Machine.make71
1 files changed, 71 insertions, 0 deletions
diff --git a/rules/pre/Machine.make b/rules/pre/Machine.make
new file mode 100644
index 000000000..480c1eba4
--- /dev/null
+++ b/rules/pre/Machine.make
@@ -0,0 +1,71 @@
+# -*-makefile-*-
+#
+# This file contains global machine/cpu dependent definitions.
+#
+# Copyright (C) 2011 by Stephan Linz <linz@li-pro.net>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+# ----------------------------------------------------------------------------
+# Machine & CPU Defines (mainly SoftCPU)
+# ----------------------------------------------------------------------------
+
+#
+# Xilinx MicroBlaze, SoftCPU inside a FPGA
+#
+ifdef PTXCONF_ARCH_MICROBLAZE
+
+ # Use defines by Xilinx BSP (borrowed from Linux kernel)
+ ifdef PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP
+
+ # What CPU vesion are we building for, and crack it open
+ # as major.minor.rev
+ CPU_VER := $(shell echo $(PTXCONF_XILINX_MICROBLAZE0_HW_VER))
+ CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
+ CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
+ CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
+
+ export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
+
+ # Use cpu-related PTXCONF_ vars to set compile options.
+ # The various PTXCONF_XILINX cpu features options are integers 0/1/2...
+ # rather than bools y/n
+
+ # Work out HW multiplier support. This is icky.
+ # 1. Spartan2 has no HW multipliers.
+ # 2. MicroBlaze v3.x always uses them, except in Spartan 2
+ # 3. All other FPGa/CPU ver combos, we can trust the PTXCONF_ settings
+ ifeq (,$(findstring spartan2,$(PTXCONF_XILINX_MICROBLAZE0_FAMILY)))
+ ifeq ($(CPU_MAJOR),3)
+ CPUFLAGS-1 += -mno-xl-soft-mul
+ else
+ # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support.
+ CPUFLAGS-$(subst 1,,$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
+ endif
+ endif
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
+
+ ifdef PTXCONF_HAS_HARDFLOAT
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mhard-float
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mxl-float-convert
+ CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mxl-float-sqrt
+ endif
+
+ CPUFLAGS-1 += -mcpu=v$(CPU_VER)
+
+ CPUFLAGS := $(CPUFLAGS-1) $(CPUFLAGS-2)
+
+ PTXCONF_TARGET_EXTRA_CFLAGS += $(CPUFLAGS)
+ PTXCONF_TARGET_EXTRA_CXXFLAGS += $(CPUFLAGS)
+
+ endif # PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP
+
+endif # PTXCONF_ARCH_MICROBLAZE
+