From patchwork Thu Jul 25 00:09:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zankel X-Patchwork-Id: 261562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4E3B12C00C5 for ; Thu, 25 Jul 2013 10:10:12 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; q=dns; s=default; b=RS3NsCiSquOeDbU++VOtYwql3bCLt 5BuMZF8PQolA2I9F0IwU47P8XiQeqOz8DhBDy5vFysSz2FkSEqgfPBXdOTGzV+iJ Eh5hs39mhx1P3ZGSnTaOE2D1pYisSBnQUVCYrp5y4qfYqNEGSJHnZP7WHiGr/C+J vCN/OZ0uuDULhY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; s=default; bh=hUArSc0M+oPpPz19O5CfdjDhYNw=; b=sg1 FLesHrw4QeBxk0cm6o8KK8bWQJGhlkclEb9auNg3zOtpTz6CphUr6+BtjzauJpPE ok3AFPdDQJm/HKyTi14qCRTeipLvnAYOO6aQ/xDRROkeizW4bYUd2UAiAXMQB5Rm RipmLAJOX5eNX9TABD7lx9Q5t3xud16iFG75/UHk= Received: (qmail 877 invoked by alias); 25 Jul 2013 00:10:03 -0000 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org Received: (qmail 860 invoked by uid 89); 25 Jul 2013 00:10:03 -0000 X-Spam-SWARE-Status: No, score=2.8 required=5.0 tests=AWL, BAYES_50, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_SOFTFAIL, TW_BF autolearn=no version=3.3.1 Received: from Unknown (HELO mail-pb0-f49.google.com) (209.85.160.49) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 25 Jul 2013 00:10:02 +0000 Received: by mail-pb0-f49.google.com with SMTP id jt11so28631pbb.8 for ; Wed, 24 Jul 2013 17:09:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:x-gm-message-state; bh=cOoEn+CIu0eil4Br2aiJKdEP30la/6t/BBgZdOKjVHs=; b=RwycIyQxgX9AHnQil9c0+UyrkkmnsVqkvU2/UaD8qgKPpXib1b5JcJBP9Hd8UWi2px 5Pfjlx8mfQ/ebWU4VlSkuywJQDM6Eti0LFRlsLAQumeEc7QTwvu9Aw3q8NtXEsDhS0aD sLoQSEbUa+HMPgPCPKbAE1LrHh4P7bznG05HVSu8+2nIlp7uVsveeKHdB2oGp9GU4ogB u4yJ+cGRsIBD/vzxzpL/HHOvmSdKf/IYIy+0XeVoZSwx9U+eCo6S5vNoiY+lpbU5cZ8m neslJ8nDT5S2mI4YupLr7f+vKYXAr7W7BF838K30iVE7QurBV/HJcjO5tnH64seyWDJV adEw== X-Received: by 10.66.119.35 with SMTP id kr3mr46337642pab.149.1374710994618; Wed, 24 Jul 2013 17:09:54 -0700 (PDT) Received: from Chriss-MacBook-Pro.local (c-67-161-9-61.hsd1.ca.comcast.net. [67.161.9.61]) by mx.google.com with ESMTPSA id ys4sm50415803pbb.9.2013.07.24.17.09.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Jul 2013 17:09:53 -0700 (PDT) Message-ID: <51F06CCF.1010704@zankel.net> Date: Wed, 24 Jul 2013 17:09:51 -0700 From: Chris Zankel User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: crossgcc@sourceware.org, yann.morin.1998@free.fr Subject: Adding support for the Xtensa architecture in crosstool-NG X-Gm-Message-State: ALoCoQkQH7y8tH6IASZDWgACu339wVMtP2pPA24sKNa6lN2R0QHS7zPIhGu0xG9y93NpPjk6dM1/ X-Virus-Found: No Hi, It would be great if you'd consider adding the patches to support the Xtensa architecture. Because it's a configurable architecture, there's a little bit of tweaking required if someone wants to build a toolchain for a different processor configuration than the default one that comes with the toolchain. I have combined that logic into a single function, which each component (gcc, bintuils, gdb) must call if building for a non-default Xtensa configuration (i.e. when CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE is empty). Please let me know if you have any questions or feedback. Thanks, -Chris # HG changeset patch # User Chris Zankel # Date 1374703847 25200 # Node ID 40864183a101b211d788ad94f569af324c74e56e # Parent 58ca31386bfbb48a522724dca79040efd54041c3 xtensa: add support for the configurable Xtensa architecture. The Xtensa processor architecture is a configurable, extensible, and synthesizable 32-bit RISC processor core. Processor and SOC vendors can select from various processor options and even create customized instructions in addition to a base ISA to tailor the processor for a particular application. Because of the configurability, the build process requires one additional step for gcc, binutils, and gdb to update the default configuration. These configurations are packed into an 'overlay' tar image, and are simply untarred on top of the default configuration during the build. --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -r 58ca31386bfb -r 40864183a101 config/arch/xtensa.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/arch/xtensa.in Wed Jul 24 15:10:47 2013 -0700 @@ -0,0 +1,20 @@ +# xtensa specific configuration file + +## select ARCH_SUPPORTS_32 +## select ARCH_SUPPORTS_BOTH_MMU +## select ARCH_DEFAULT_HAS_MMU +## +## help The xtensa architecture +## help +## help Xtensa is a configurable and extensible processor architecture. +## help Supporting a specific configuration typically requires minor +## help modifications to a small set of configuration files in various +## help development tools. This process is automated and only requires +## help a configuration specific 'overlay' file. +## help +## help For a custom configuration, select the XTENSA_CUSTOM option and +## help provide the name of the overlay file through the +## help CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE option. +## help +## help The default option (ARCH_xtensa_fsf) uses a built-in configuration, +## help which may or may not work for a particular Xtensa processor. diff -r 58ca31386bfb -r 40864183a101 config/arch/xtensa.in.2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/arch/xtensa.in.2 Wed Jul 24 15:10:47 2013 -0700 @@ -0,0 +1,30 @@ +choice + prompt "Target Architecture Variant" + default ARCH_xtensa_fsf +config XTENSA_CUSTOM + bool "Custom Xtensa processor configuration" + +config ARCH_xtensa_fsf + bool "fsf - Default configuration" + +endchoice + +config ARCH_XTENSA_CUSTOM_OVERLAY_FILE + string "Custom Xtensa process configuration file name" + depends on XTENSA_CUSTOM + default "" + help + Enter the name of the custom processor configuration + overlay file or leave blank to use the default 'xtensa-overlay.tar'. + For more information about this option, please also consult + the 'help' section of the 'Target Architecture Variant' + option above. + +config ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION + string "Full path to custom Xtensa processor configurations" + depends on XTENSA_CUSTOM + default "" + help + Enter the path to the directory for the custom processor + configuration file or leave blank to use the default location: + CT_CUSTOM_LOCATION_ROOT_DIR diff -r 58ca31386bfb -r 40864183a101 scripts/build/arch/xtensa.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/build/arch/xtensa.sh Wed Jul 24 15:10:47 2013 -0700 @@ -0,0 +1,75 @@ +# Compute Xtensa-specific values + +CT_DoArchTupleValues() { + # The architecture part of the tuple: + CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}" + # The system part of the tuple: + case "${CT_LIBC}" in + *glibc) CT_TARGET_SYS=gnu;; + uClibc) CT_TARGET_SYS=uclibc;; + esac +} + +# This function updates the specified component (binutils, gcc, gdb, etc.) +# with the processor specific configuration. +CT_ConfigureXtensa() { + local component="${1}" + local version="${2}" + local custom_overlay="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" + local custom_location="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION}" + + if [ -z "${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" ]; then + custom_overlay="xtensa-overlay.tar" + fi + + local full_file="${CT_TARBALLS_DIR}/${custom_overlay}" + local basename="${component}-${version}" + local ext + + CT_TestAndAbort "${custom_overlay}: CT_CUSTOM_LOCATION_ROOT_DIR or CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION must be set." \ + -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${custom_location}" + + if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" \ + -a -z "${custom_location}" ]; then + custom_location="${CT_CUSTOM_LOCATION_ROOT_DIR}" + fi + + if ! ext="$(CT_GetFileExtension "${basename}")"; then + CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'" + return 1 + fi + + if [ -e "${CT_SRC_DIR}/.${basename}.configuring" ]; then + CT_DoLog ERROR "The '${basename}' source were partially configured." + CT_DoLog ERROR "Please remove first:" + CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patch'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.configuring'" + CT_Abort + fi + + CT_DoLog EXTRA "Using '${custom_config}' from ${custom_location}" + CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_config}" \ + "${CT_TARBALLS_DIR}/${custom_config}" + + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configuring" + + CT_Pushd "${CT_SRC_DIR}/${basename}" + + tar_opts=( "--strip-components=1" ) + tar_opts+=( "-xv" ) + + case "${ext}" in + .tar) CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}";; + .tar.gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}"; + *) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension" + return 1 + ;; + esac + + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured" + CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring" + + CT_Popd +} diff -r 58ca31386bfb -r 40864183a101 scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Wed Jul 10 12:40:21 2013 +0100 +++ b/scripts/build/binutils/binutils.sh Wed Jul 24 15:10:47 2013 -0700 @@ -37,6 +37,10 @@ CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}" CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}" fi + + if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then + CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}" + fi } # Build binutils for build -> target diff -r 58ca31386bfb -r 40864183a101 scripts/build/cc/gcc.sh --- a/scripts/build/cc/gcc.sh Wed Jul 10 12:40:21 2013 +0100 +++ b/scripts/build/cc/gcc.sh Wed Jul 24 15:10:47 2013 -0700 @@ -58,6 +58,10 @@ ]; then CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" fi + + if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then + CT_ConfigureXtensa "gcc" "${CT_CC_VERSION}" + fi } #------------------------------------------------------------------------------ diff -r 58ca31386bfb -r 40864183a101 scripts/build/debug/300-gdb.sh --- a/scripts/build/debug/300-gdb.sh Wed Jul 10 12:40:21 2013 +0100 +++ b/scripts/build/debug/300-gdb.sh Wed Jul 24 15:10:47 2013 -0700 @@ -93,6 +93,10 @@ CT_Extract "expat-${CT_DEBUG_GDB_EXPAT_VERSION}" CT_Patch "expat" "${CT_DEBUG_GDB_EXPAT_VERSION}" fi + + if [ -n "${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" ]; then + CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}" + fi } do_debug_gdb_build() {