From patchwork Thu Nov 15 13:30:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 199279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 333342C00C2 for ; Fri, 16 Nov 2012 00:31:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C6407101E2D; Thu, 15 Nov 2012 13:31:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7-Gtwu2Nkxon; Thu, 15 Nov 2012 13:30:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7BF5D101D15; Thu, 15 Nov 2012 13:30:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 741228F753 for ; Thu, 15 Nov 2012 13:30:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 08DFC8A8A5 for ; Thu, 15 Nov 2012 13:30:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pyalPw7LiOWG for ; Thu, 15 Nov 2012 13:30:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [88.190.12.23]) by whitealder.osuosl.org (Postfix) with ESMTP id C93C38A3B3 for ; Thu, 15 Nov 2012 13:30:44 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 21C0E180; Thu, 15 Nov 2012 14:30:36 +0100 (CET) Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id F10AC27D; Thu, 15 Nov 2012 14:30:22 +0100 (CET) From: Thomas Petazzoni To: buildroot@busybox.net Date: Thu, 15 Nov 2012 14:30:15 +0100 Message-Id: <7c693cd311e2993cf78952db386b977b21196979.1352986210.git.thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Subject: [Buildroot] [PATCH 5/5] xtensa: support configurable processor configurations X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Chris Zankel 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 Signed-off-by: Thomas Petazzoni --- arch/Config.in.xtensa | 31 +++++++++++++++++++++++++++++++ package/binutils/binutils.mk | 9 +++++++++ toolchain/gcc/gcc-uclibc-4.x.mk | 4 ++++ toolchain/gdb/gdb.mk | 4 ++++ 4 files changed, 48 insertions(+) diff --git a/arch/Config.in.xtensa b/arch/Config.in.xtensa index 66749ee..af66125 100644 --- a/arch/Config.in.xtensa +++ b/arch/Config.in.xtensa @@ -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 diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk index 6c51fc7..82f8fd2 100644 --- a/package/binutils/binutils.mk +++ b/package/binutils/binutils.mk @@ -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)) diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk index 1a075cc..1710070 100644 --- a/toolchain/gcc/gcc-uclibc-4.x.mk +++ b/toolchain/gcc/gcc-uclibc-4.x.mk @@ -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 diff --git a/toolchain/gdb/gdb.mk b/toolchain/gdb/gdb.mk index 6b029a8..dc305a6 100644 --- a/toolchain/gdb/gdb.mk +++ b/toolchain/gdb/gdb.mk @@ -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