Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion examples/arm/executor_runner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/arm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 0 additions & 25 deletions examples/arm/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading