mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-31 16:36:14 +00:00
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. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
57de8dcf22
commit
81328ed1cb
20
config/arch/xtensa.in
Normal file
20
config/arch/xtensa.in
Normal file
@ -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_NAME 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.
|
30
config/arch/xtensa.in.2
Normal file
30
config/arch/xtensa.in.2
Normal file
@ -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_NAME
|
||||
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
|
78
scripts/build/arch/xtensa.sh
Normal file
78
scripts/build/arch/xtensa.sh
Normal file
@ -0,0 +1,78 @@
|
||||
# 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="xtensa_${CT_ARCH_XTENSA_CUSTOM_NAME}.tar"
|
||||
local custom_location="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION}"
|
||||
|
||||
if [ -z "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
|
||||
custom_overlay="xtensa-overlay.tar"
|
||||
fi
|
||||
|
||||
if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" \
|
||||
-a -z "${custom_location}" ]; then
|
||||
custom_location="${CT_CUSTOM_LOCATION_ROOT_DIR}"
|
||||
fi
|
||||
|
||||
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}"
|
||||
|
||||
local full_file="${custom_location}/${custom_overlay}"
|
||||
local basename="${component}-${version}"
|
||||
local ext
|
||||
|
||||
ext=${full_file/*./.}
|
||||
|
||||
if [ -z "${ext}" ] ; then
|
||||
CT_DoLog WARN "'${full_file}' not found"
|
||||
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_overlay}' from ${custom_location}"
|
||||
CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_overlay}" \
|
||||
"${CT_TARBALLS_DIR}/${custom_overlay}"
|
||||
|
||||
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}";;
|
||||
.gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";;
|
||||
.bz2) bzip2 -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
|
||||
}
|
@ -46,6 +46,10 @@ do_binutils_extract() {
|
||||
CT_Patch "elf2flt" "${CT_ELF2FLT_GIT_CSET}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
|
||||
CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Build binutils for build -> target
|
||||
|
@ -63,6 +63,10 @@ do_gcc_extract() {
|
||||
]; then
|
||||
CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar"
|
||||
fi
|
||||
|
||||
if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
|
||||
CT_ConfigureXtensa "gcc" "${CT_CC_GCC_VERSION}"
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -100,6 +100,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_NAME}" ]; then
|
||||
CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}"
|
||||
fi
|
||||
}
|
||||
|
||||
do_debug_gdb_build() {
|
||||
|
@ -38,6 +38,10 @@ do_libc_extract() {
|
||||
|
||||
CT_Extract "newlib-${CT_LIBC_VERSION}"
|
||||
CT_Patch "newlib" "${CT_LIBC_VERSION}"
|
||||
|
||||
if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
|
||||
CT_ConfigureXtensa "newlib" "${CT_LIBC_VERSION}"
|
||||
fi
|
||||
}
|
||||
|
||||
do_libc_check_config() {
|
||||
@ -48,6 +52,11 @@ do_libc_start_files() {
|
||||
CT_DoStep INFO "Installing C library headers & start files"
|
||||
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/." \
|
||||
"${CT_HEADERS_DIR}"
|
||||
if [ "${CT_ARCH_xtensa}" = "y" ]; then
|
||||
CT_DoLog EXTRA "Installing Xtensa headers"
|
||||
CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/sys/xtensa/include/." \
|
||||
"${CT_HEADERS_DIR}"
|
||||
fi
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user