From patchwork Sat Dec 27 16:08:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 424223 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 01FBC1400D5 for ; Sun, 28 Dec 2014 03:09:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=CpDGYhsW9RLqaEfYD9M/yQ25HWn+Ziq HZIUIuh6UxhyPZsEcj3jtvQuLpzmkMhXTRPjDdJIOw5gbf3O6fLXT8YXkuZw5aGt 4rI5Ap7cAtKdr5bGa7fHgUmV1U542t3vzTQB5Za/PeXeYDR1XaR/c2+4l99eU3zh +8qvDRq3L/1A= 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:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=EIDU79+pTVj/2bycDAMgvKWd9nc=; b=sZpka +pNpS+Xn/hdQpAq70F4eeul3331pXMjDWKHDEnjycSlhhBvbc4BhnUMKnbNM+LeT EM6cvO5XGv2X40Tt4y8mu9voWCqylkjkVsN1wUWJIMN1ekKiytBmlmdbW1VTvrKJ wnpDiiL4p+KkFd4grCKSK9QstuYJZF7HR56ZcE= Received: (qmail 19990 invoked by alias); 27 Dec 2014 16:09:02 -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 19831 invoked by uid 89); 27 Dec 2014 16:09:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-la0-f53.google.com Received: from mail-la0-f53.google.com (HELO mail-la0-f53.google.com) (209.85.215.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 27 Dec 2014 16:09:00 +0000 Received: by mail-la0-f53.google.com with SMTP id gm9so9508821lab.40 for ; Sat, 27 Dec 2014 08:08:56 -0800 (PST) X-Received: by 10.112.171.199 with SMTP id aw7mr47676792lbc.40.1419696536651; Sat, 27 Dec 2014 08:08:56 -0800 (PST) Received: from octofox.metropolis ([5.19.183.212]) by mx.google.com with ESMTPSA id ba3sm3490696lbc.35.2014.12.27.08.08.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Dec 2014 08:08:55 -0800 (PST) From: Max Filippov To: crossgcc@sourceware.org Cc: Bryan Hundven , Baruch Siach , Chris Zankel , Max Filippov Subject: [PATCH 1/2] xtensa: add support for the configurable Xtensa architecture Date: Sat, 27 Dec 2014 19:08:34 +0300 Message-Id: <1419696515-11455-2-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1419696515-11455-1-git-send-email-jcmvbkbc@gmail.com> References: <1419696515-11455-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes From: Baruch Siach 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. This patch was originally authored by Chris Zankel. This version fixes a few issues raised by Yann E. MORIN, and tested on latest tip. Signed-off-by: Max Filippov --- config/arch/xtensa.in | 20 +++++++++++++++ config/arch/xtensa.in.2 | 30 ++++++++++++++++++++++ scripts/build/arch/xtensa.sh | 51 ++++++++++++++++++++++++++++++++++++++ scripts/build/binutils/binutils.sh | 4 +++ scripts/build/cc/gcc.sh | 4 +++ scripts/build/debug/300-gdb.sh | 4 +++ 6 files changed, 113 insertions(+) create mode 100644 config/arch/xtensa.in create mode 100644 config/arch/xtensa.in.2 create mode 100644 scripts/build/arch/xtensa.sh diff --git a/config/arch/xtensa.in b/config/arch/xtensa.in new file mode 100644 index 0000000..ecb9905 --- /dev/null +++ b/config/arch/xtensa.in @@ -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 --git a/config/arch/xtensa.in.2 b/config/arch/xtensa.in.2 new file mode 100644 index 0000000..b87cdd1 --- /dev/null +++ b/config/arch/xtensa.in.2 @@ -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 --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh new file mode 100644 index 0000000..4d512db --- /dev/null +++ b/scripts/build/arch/xtensa.sh @@ -0,0 +1,51 @@ +CT_DoArchTupleValues() { + : +} + +# 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_config="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" + local custom_location="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION}" + + local full_file="${CT_TARBALLS_DIR}/${custom_config}" + local basename="${component}-${version}" + + CT_TestAndAbort "${custom_config}: 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 [ -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 DEBUG "Using '${custom_config}' from ${custom_location}" + CT_DoExecLog INFO 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" ) + + CT_DoLog DEBUG "Extracting ${full_file} for ${component}" + CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}" + + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured" + CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring" + + CT_Popd +} diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index 1cc8739..9c4b277 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -39,6 +39,10 @@ do_binutils_extract() { CT_Patch "elf2flt" "${CT_ELF2FLT_GIT_CSET}" fi fi + + if [ -n "${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" ]; then + CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}" + fi } # Build binutils for build -> target diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 632bc8c..eca356d 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -60,6 +60,10 @@ do_cc_extract() { ]; 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_OVERLAY_FILE}" ]; then + CT_ConfigureXtensa "gcc" "${CT_CC_VERSION}" + fi } #------------------------------------------------------------------------------ diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 149a2f8..c9afb79 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -97,6 +97,10 @@ do_debug_gdb_extract() { 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() {