diff --git a/examples/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index 9b976fc2bb..c17888ca0b 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Arm Limited and/or its affiliates. +# Copyright 2023-2025 Arm Limited and/or its affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. @@ -44,6 +44,37 @@ set(PYTHON_EXECUTABLE CACHE PATH "Define to override python executable used" ) +# Download ethos_u dependency if needed. +include(FetchContent) +set(ethos_u_base_rev "24.08") +FetchContent_Declare( + ethos_u + GIT_REPOSITORY https://git.gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u.git + GIT_TAG ${ethos_u_base_rev} + SOURCE_DIR ${ETHOS_SDK_PATH} + BINARY_DIR ${ETHOS_SDK_PATH} + SUBBUILD_DIR ${ETHOS_SDK_PATH}/../ethos_u-subbuild + SOURCE_SUBDIR none + ) + +FetchContent_MakeAvailable(ethos_u) + +# Get ethos_u externals only if core_platform folder does not already exist. +if(NOT EXISTS "${ETHOS_SDK_PATH}/core_platform") + execute_process(COMMAND ${PYTHON_EXECUTABLE} fetch_externals.py -c ${ethos_u_base_rev}.json fetch + WORKING_DIRECTORY ${ETHOS_SDK_PATH} + COMMAND_ECHO STDOUT + ) +endif() + +# Always patch the core_platform repo since this is fast enough. +set(core_platform_base_rev "b728c774158248ba2cad8e78a515809e1eb9b77f") +set(patch_dir "examples/arm/ethos-u-setup") +execute_process(COMMAND bash -c "pwd && source backends/arm/scripts/utils.sh && patch_repo ${ETHOS_SDK_PATH}/core_platform ${core_platform_base_rev} ${patch_dir}" + WORKING_DIRECTORY ${ET_DIR_PATH} + COMMAND_ECHO STDOUT +) + # Selects timing adapter values matching system_config. # Default is Ethos_U55_High_End_Embedded, simulating optimal hardware for the Corestone-300. set(SYSTEM_CONFIG "Ethos_U55_High_End_Embedded" CACHE STRING "System config") diff --git a/examples/arm/run.sh b/examples/arm/run.sh index d47e2620e6..1a50f59d45 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -81,8 +81,8 @@ else fi executor_runner_path=$(realpath ${executor_runner_path}) +mkdir -p ${root_dir}/ethos-u ethos_u_root_dir="$(cd ${root_dir}/ethos-u && pwd)" -ethos_u_build_dir=${ethos_u_root_dir}/core_platform/build setup_path_script=${root_dir}/setup_path.sh # Executorch diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index 334b097936..49729fdbf6 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -179,23 +179,7 @@ function setup_toolchain() { echo "export PATH=\${PATH}:${toolchain_bin_path}" >> ${setup_path_script} } -function setup_ethos_u() { - # This is the main dir which will pull more repos to do baremetal software dev for cs300 - echo "[${FUNCNAME[0]}] Setting up the repo" - cd "${root_dir}" - [[ ! -d ethos-u ]] && \ - git clone ${ethos_u_repo_url} - cd ethos-u - git reset --hard ${ethos_u_base_rev} - python3 ./fetch_externals.py -c ${ethos_u_base_rev}.json fetch - - pip install pyelftools - echo "[${FUNCNAME[0]}] Done @ $(git describe --all --long 3> /dev/null) in ${root_dir}/ethos-u dir." -} - - function setup_tosa_reference_model() { - # reference_model flatbuffers version clashes with Vela. # go with Vela's since it newer. # Vela's flatbuffer requirement is expected to loosen, then remove this. MLETORCH-565 @@ -236,15 +220,6 @@ source $et_dir/backends/arm/scripts/utils.sh # Setup toolchain setup_toolchain -# Setup the ethos-u dev environment -setup_ethos_u - -# Patch the ethos-u dev environment to include executorch application -repo_dir="${root_dir}/ethos-u/core_platform" -base_rev=b728c774158248ba2cad8e78a515809e1eb9b77f -patch_dir=${script_dir}/ethos-u-setup/ -patch_repo $repo_dir $base_rev $patch_dir - # Setup the tosa_reference_model setup_tosa_reference_model