]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
xtensa: support configurable processor configurations
authorChris Zankel <chris@zankel.net>
Thu, 15 Nov 2012 03:53:52 +0000 (03:53 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Thu, 15 Nov 2012 15:39:48 +0000 (16:39 +0100)
Xtensa is a configurable processor architecture, which allows to define
additional instructions and registers. The required variant specific
information for the toolchain is delivered in an 'overlay' file, which
needs to be 'untarred' to the corresponding directories after the
source is installed and patched.
This patch provides support for binutils, gcc, and gdb with a very
limited changes to the build scripts. These additions are only executed
for the Xtensa architecture and have no effect on other architectures.

[Thomas: rebased on top of the 'arch: improve definition of gcc mtune,
mcpu, etc.' patch, and changed 'Target ABI' to 'Target Architecture
Variant'].

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
arch/Config.in.xtensa
package/binutils/binutils.mk
toolchain/gcc/gcc-uclibc-4.x.mk
toolchain/gdb/gdb.mk

index 66749eeb13a5ec2acb0316fa666d04a6dc8d2548..af66125cbd35b742d35f1e2293916e254fb0af4a 100644 (file)
@@ -1,2 +1,33 @@
+choice
+       prompt "Target Architecture Variant"
+       depends on BR2_xtensa
+       default BR2_xtensa_fsf
+config BR2_xtensa_custom
+       bool "Custom Xtensa processor configuration"
+config BR2_xtensa_fsf
+       bool "fsf - Default configuration"
+endchoice
+
+config BR2_xtensa_custom_name
+       string "Custom Xtensa processor configuration anme"
+       depends on BR2_xtensa_custom
+       default ""
+       help
+         Name given to a custom Xtensa processor configuration.
+
+config BR2_xtensa_core_name
+       string
+       default BR2_xtensa_custom_name  if BR2_xtensa_custom
+       default ""                      if BR2_xtensa_fsf
+
+config BR2_xtensa_overlay_dir
+       string "Overlay directory for custom configuration"
+       depends on BR2_xtensa_custom
+       default ""
+       help
+         Provide a directory path that contains the overlay files
+         for the custom configuration. The path is based on the
+         buildroot top directory.
+
 config BR2_ARCH
        default "xtensa"        if BR2_xtensa
index 6c51fc786845f856467966ad2654712e0264a02e..82f8fd2346bde91a6b09e1c6d8c4eb0744269272 100644 (file)
@@ -68,5 +68,14 @@ define BINUTILS_INSTALL_TARGET_CMDS
 endef
 endif
 
+XTENSA_CORE_NAME = $(call qstrip, $(BR2_xtensa_core_name))
+ifneq ($(XTENSA_CORE_NAME),)
+define BINUTILS_XTENSA_PRE_PATCH
+       tar xf $(BR2_xtensa_overlay_dir)/xtensa_$(XTENSA_CORE_NAME).tar \
+               -C $(@D) bfd include ld
+endef
+HOST_BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
index 1a075cc00477d405ae53200be6f453e0ec1baa99..1710070edda41755f76975419e4209e1231e3dfd 100644 (file)
@@ -251,6 +251,10 @@ $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
        rm -rf $(GCC_DIR)
        $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
        $(call CONFIG_UPDATE,$(@D))
+ifneq ($(call qstrip, $(BR2_xtensa_core_name)),)
+       tar xf $(BR2_xtensa_overlay_dir)/xtensa_$(call qstrip,\
+               $(BR2_xtensa_core_name)).tar -C $(@D) include
+endif
        touch $@
 
 gcc-patched: $(GCC_DIR)/.patched
index 6b029a8c6d1469f4ac15ec82ea7f50bc8c07726e..dc305a63bf791ee2d93b21af2b2b90896ff2a59c 100644 (file)
@@ -25,6 +25,10 @@ gdb-unpacked: $(GDB_DIR)/.unpacked
 $(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
        mkdir -p $(GDB_DIR)
        $(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(GDB_DIR) $(TAR_STRIP_COMPONENTS)=1 $(TAR_OPTIONS) -
+ifneq ($(call qstrip, $(BR2_xtensa_core_name)),)
+       tar xf $(BR2_xtensa_overlay_dir)/xtensa_$(call qstrip, \
+               $(BR2_xtensa_core_name)).tar -C $(@D) bfd include gdb
+endif
 ifneq ($(wildcard $(GDB_PATCH_DIR)),)
        support/scripts/apply-patches.sh $(GDB_DIR) $(GDB_PATCH_DIR) \*.patch
 endif