Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Tools: Testbench: xt-testbench#6513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6764d183e1c2d485dca61acdc21fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,27 +5,42 @@ | ||
| # fail on any errors | ||
| set -e | ||
| # Defaults | ||
| BUILD_TYPE=native | ||
| BUILD_DIR_NAME=build_testbench | ||
| BUILD_TARGET=install | ||
| print_usage() | ||
| { | ||
| cat <<EOFUSAGE | ||
| usage: $0 [-f] | ||
| usage: $0 [-f] [-p <platform>] | ||
| -p Build testbench binary for xt-run for selected platform, e.g. -p tgl | ||
| -f Build testbench with compiler provided by fuzzer | ||
| (default path: $HOME/sof/work/AFL/afl-gcc) | ||
| EOFUSAGE | ||
| } | ||
| # die is copy from xtensa-build-all.sh | ||
| die() | ||
| { | ||
| >&2 printf '%s ERROR: ' "$0" | ||
| # We want die() to be usable exactly like printf | ||
| # shellcheck disable=SC2059 | ||
| >&2 printf "$@" | ||
| exit 1 | ||
| } | ||
| rebuild_testbench() | ||
| { | ||
| cd "$BUILD_TESTBENCH_DIR" | ||
| rm -rf build_testbench | ||
| mkdir build_testbench | ||
| cd build_testbench | ||
| rm -rf "$BUILD_DIR_NAME" | ||
| mkdir "$BUILD_DIR_NAME" | ||
| cd "$BUILD_DIR_NAME" | ||
singalsu marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| cmake -DCMAKE_INSTALL_PREFIX=install .. | ||
| cmake --build . -- -j"$(nproc)" install | ||
| cmake --build . -- -j"$(nproc)" $BUILD_TARGET | ||
| } | ||
| export_CC_with_afl() | ||
| @@ -34,22 +49,89 @@ export_CC_with_afl() | ||
| export CC=${SOF_AFL} | ||
| } | ||
| setup_xtensa_tools_build() | ||
| { | ||
| BUILD_TYPE=xt | ||
| BUILD_TARGET= | ||
| BUILD_DIR_NAME=build_xt_testbench | ||
| # check needed environment variables | ||
| test -n "${XTENSA_TOOLS_ROOT}" || die "XTENSA_TOOLS_ROOT need to be set.\n" | ||
| # Get compiler version for platform | ||
| source "$SCRIPT_DIR/set_xtensa_params.sh" "$BUILD_PLATFORM" | ||
singalsu marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| test -n "${XTENSA_TOOLS_VERSION}" || | ||
| die "Illegal platform $BUILD_PLATFORM, no XTENSA_TOOLS_VERSION found.\n" | ||
| test -n "${XTENSA_CORE}" || | ||
| die "Illegal platform $BUILD_PLATFORM, no XTENSA_CORE found.\n" | ||
| compiler="xt-xcc" | ||
| install_bin=install/tools/$XTENSA_TOOLS_VERSION/XtensaTools/bin | ||
| tools_bin=$XTENSA_TOOLS_ROOT/$install_bin | ||
| testbench_sections="-Wl,--sections-placement $BUILD_TESTBENCH_DIR/testbench_xcc_sections.txt" | ||
| export CC=$tools_bin/$compiler | ||
| export LD=$tools_bin/xt-ld | ||
| export OBJDUMP=$tools_bin/xt-objdump | ||
| export LDFLAGS="-mlsp=sim -Wl,-LE $testbench_sections" | ||
| export XTENSA_CORE | ||
| } | ||
| export_xtensa_setup() | ||
| { | ||
| export_dir=$BUILD_TESTBENCH_DIR/$BUILD_DIR_NAME | ||
| export_script=$export_dir/xtrun_env.sh | ||
| xtbench=$export_dir/testbench | ||
| xtbench_run="XTENSA_CORE=$XTENSA_CORE \$XTENSA_TOOLS_ROOT/$install_bin/xt-run $xtbench" | ||
| cat <<EOFSETUP > "$export_script" | ||
| export XTENSA_TOOLS_ROOT=$XTENSA_TOOLS_ROOT | ||
| export XTENSA_CORE=$XTENSA_CORE | ||
| XTENSA_PATH=$tools_bin | ||
| EOFSETUP | ||
| } | ||
| testbench_usage() | ||
| { | ||
| case "$BUILD_TYPE" in | ||
| xt) | ||
| export_xtensa_setup | ||
| cat <<EOFUSAGE | ||
| Success! Testbench binary for $BUILD_PLATFORM is in $xtbench | ||
| it can be run with command: | ||
| $xtbench_run -h | ||
| Alternatively with environment setup to match build: | ||
| source $export_script | ||
| \$XTENSA_PATH/xt-run $xtbench -h | ||
| EOFUSAGE | ||
| esac | ||
| } | ||
| main() | ||
| { | ||
| SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
| SOF_REPO=$(dirname "$SCRIPT_DIR") | ||
| BUILD_TESTBENCH_DIR="$SOF_REPO"/tools/testbench | ||
| : "${SOF_AFL:=$HOME/sof/work/AFL/afl-gcc}" | ||
| while getopts "fh" OPTION; do | ||
| case "$OPTION" in | ||
| f) export_CC_with_afl;; | ||
| h) print_usage; exit 1;; | ||
| *) print_usage; exit 1;; | ||
| esac | ||
| while getopts "fhp:" OPTION; do | ||
| case "$OPTION" in | ||
| p) | ||
| BUILD_PLATFORM="$OPTARG" | ||
| setup_xtensa_tools_build | ||
| ;; | ||
| f) export_CC_with_afl;; | ||
| h) print_usage; exit 1;; | ||
| *) print_usage; exit 1;; | ||
| esac | ||
| done | ||
| rebuild_testbench | ||
| testbench_usage | ||
| } | ||
| main "$@" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
| # Sourced script argument is a non-standard bash extension | ||
| platform=$1 | ||
marc-hb marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| # Note: This duplicates xtensa-build-zephyr.py | ||
| case "$platform" in | ||
| tgl) | ||
| PLATFORM="tgplp" | ||
| XTENSA_CORE="cavs2x_LX6HiFi3_2017_8" | ||
| HOST="xtensa-cnl-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| HAVE_ROM='yes' | ||
| IPC4_CONFIG_OVERLAY="tigerlake_ipc4" | ||
| # default key for TGL | ||
| PLATFORM_PRIVATE_KEY="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" | ||
| ;; | ||
| tgl-h) | ||
| PLATFORM="tgph" | ||
| XTENSA_CORE="cavs2x_LX6HiFi3_2017_8" | ||
| HOST="xtensa-cnl-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| HAVE_ROM='yes' | ||
| # default key for TGL | ||
| PLATFORM_PRIVATE_KEY="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" | ||
| ;; | ||
| imx8) | ||
| PLATFORM="imx8" | ||
| XTENSA_CORE="hifi4_nxp_v3_3_1_2_2017" | ||
| HOST="xtensa-imx-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| ;; | ||
| imx8x) | ||
| PLATFORM="imx8x" | ||
| XTENSA_CORE="hifi4_nxp_v3_3_1_2_2017" | ||
| HOST="xtensa-imx-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| ;; | ||
| imx8m) | ||
| PLATFORM="imx8m" | ||
| XTENSA_CORE="hifi4_mscale_v0_0_2_2017" | ||
| HOST="xtensa-imx8m-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| ;; | ||
| imx8ulp) | ||
| PLATFORM="imx8ulp" | ||
| XTENSA_CORE="hifi4_nxp2_ulp_prod" | ||
| HOST="xtensa-imx8ulp-elf" | ||
| XTENSA_TOOLS_VERSION="RG-2017.8-linux" | ||
| ;; | ||
| rn) | ||
| PLATFORM="renoir" | ||
| XTENSA_CORE="ACP_3_1_001_PROD_2019_1" | ||
| HOST="xtensa-rn-elf" | ||
| XTENSA_TOOLS_VERSION="RI-2019.1-linux" | ||
| ;; | ||
| rmb) | ||
| PLATFORM="rembrandt" | ||
| ARCH="xtensa" | ||
| XTENSA_CORE="LX7_HiFi5_PROD" | ||
| HOST="xtensa-rmb-elf" | ||
| XTENSA_TOOLS_VERSION="RI-2019.1-linux" | ||
| ;; | ||
| mt8186) | ||
| PLATFORM="mt8186" | ||
| XTENSA_CORE="hifi5_7stg_I64D128" | ||
| HOST="xtensa-mt8186-elf" | ||
| XTENSA_TOOLS_VERSION="RI-2020.5-linux" | ||
| ;; | ||
| mt8188) | ||
| PLATFORM="mt8188" | ||
| XTENSA_CORE="hifi5_7stg_I64D128" | ||
| HOST="xtensa-mt8188-elf" | ||
| XTENSA_TOOLS_VERSION="RI-2020.5-linux" | ||
| ;; | ||
| mt8195) | ||
| PLATFORM="mt8195" | ||
| XTENSA_CORE="hifi4_8195_PROD" | ||
| HOST="xtensa-mt8195-elf" | ||
| XTENSA_TOOLS_VERSION="RI-2019.1-linux" | ||
| ;; | ||
| esac | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.