Skip to content

Commit 105ea68

Browse files
committed
Updating plumbing to run scripts to allow toolchain to be passed in as runtime cmd line arg
Also updates to ci flow, and som eof the comments on the PR
1 parent 184af9a commit 105ea68

File tree

6 files changed

+32
-18
lines changed

6 files changed

+32
-18
lines changed

.ci/scripts/setup-arm-zephyr-tools.sh

100644100755
File mode changed.

CMakePresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@
112112
"common"
113113
],
114114
"cacheVariables": {
115-
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/zephyr.cmake",
116-
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0"
115+
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/zephyr.cmake"
117116
}
118117
}
119118
]

backends/arm/scripts/build_executor_runner.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -eu
99
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
1010
et_root_dir=$(cd ${script_dir}/../../.. && pwd)
1111
et_root_dir=$(realpath ${et_root_dir})
12-
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
12+
toolchain=arm-none-eabi-gcc
1313
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1414
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
1515

@@ -46,6 +46,7 @@ help() {
4646
echo " --output=<FOLDER> Output folder Default: <MODEL>/<MODEL>_<TARGET INFO>.pte"
4747
echo " --et_build_root=<FOLDER> Build output root folder to use, defaults to ${et_build_root}"
4848
echo " --ethosu_tools_dir=<FOLDER> Path to your Ethos-U tools dir if you not using default: ${ethosu_tools_dir}"
49+
echo " --toolchain=<TOOLCHAIN> Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zpehyr as arm-zephyr-eabi-gcc"
4950
exit 0
5051
}
5152

@@ -63,11 +64,15 @@ for arg in "$@"; do
6364
--output=*) output_folder="${arg#*=}" ; output_folder_set=true ;;
6465
--et_build_root=*) et_build_root="${arg#*=}";;
6566
--ethosu_tools_dir=*) ethosu_tools_dir="${arg#*=}";;
67+
--toolchain=*) toolchain="${arg#*=}";;
6668
*)
6769
;;
6870
esac
6971
done
7072

73+
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake
74+
toolchain_cmake=$(realpath ${toolchain_cmake})
75+
7176
# Source the tools
7277
# This should be prepared by the setup.sh
7378
[[ -f ${setup_path_script} ]] \
@@ -116,7 +121,7 @@ else
116121
target_cpu=cortex-m85
117122
fi
118123
echo "--------------------------------------------------------------------------------"
119-
echo "Build Arm Baremetal executor_runner for ${target} with ${pte_file} using ${system_config} ${memory_mode} ${extra_build_flags} to '${output_folder}/cmake-out'"
124+
echo "Build Arm ${toolchain/-gcc/} executor_runner for ${target} with ${pte_file} using ${system_config} ${memory_mode} ${extra_build_flags} to '${output_folder}/cmake-out'"
120125
echo "--------------------------------------------------------------------------------"
121126

122127
cd ${et_root_dir}/examples/arm/executor_runner
@@ -152,8 +157,8 @@ echo "[${BASH_SOURCE[0]}] Configured CMAKE"
152157

153158
cmake --build ${output_folder}/cmake-out -j$(nproc) -- arm_executor_runner
154159

155-
echo "[${BASH_SOURCE[0]}] Generated baremetal elf file:"
160+
echo "[${BASH_SOURCE[0]}] Generated ${toolchain} elf file:"
156161
find ${output_folder}/cmake-out -name "arm_executor_runner"
157-
echo "executable_text: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $1}') bytes"
158-
echo "executable_data: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $2}') bytes"
159-
echo "executable_bss: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $3}') bytes"
162+
echo "executable_text: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $1}') bytes"
163+
echo "executable_data: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $2}') bytes"
164+
echo "executable_bss: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $3}') bytes"

backends/arm/scripts/build_executorch.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ set -eu
1313
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
1414
et_root_dir=$(cd ${script_dir}/../../.. && pwd)
1515
et_root_dir=$(realpath ${et_root_dir})
16-
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
17-
toolchain_cmake=$(realpath ${toolchain_cmake})
16+
toolchain=arm-none-eabi-gcc
1817
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1918
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
2019

@@ -30,6 +29,7 @@ help() {
3029
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}"
3130
echo " --devtools Build Devtools libs"
3231
echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log"
32+
echo " --toolchain=<TOOLCHAIN> Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zpehyr as arm-zephyr-eabi-gcc"
3333
exit 0
3434
}
3535

@@ -40,11 +40,15 @@ for arg in "$@"; do
4040
--build_type=*) build_type="${arg#*=}";;
4141
--devtools) build_devtools=true ;;
4242
--etdump) build_with_etdump=true ;;
43+
--toolchain=*) toolchain="${arg#*=}";;
4344
*)
4445
;;
4546
esac
4647
done
4748

49+
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake
50+
toolchain_cmake=$(realpath ${toolchain_cmake})
51+
4852
# Source the tools
4953
# This should be prepared by the setup.sh
5054
[[ -f ${setup_path_script} ]] \

backends/arm/scripts/build_portable_kernels.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ set -eu
1313
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
1414
et_root_dir=$(cd ${script_dir}/../../.. && pwd)
1515
et_root_dir=$(realpath ${et_root_dir})
16-
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
17-
toolchain_cmake=$(realpath ${toolchain_cmake})
16+
toolchain=arm-none-eabi-gcc
1817
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1918
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
2019

@@ -29,6 +28,7 @@ help() {
2928
echo " --et_build_root=<FOLDER> Build output root folder to use, defaults to ${et_build_root}"
3029
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}"
3130
echo " --portable_kernels=<OPS> Comma separated list of portable (non delagated) kernels to include Default: ${portable_kernels}"
31+
echo " --toolchain=<TOOLCHAIN> Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zpehyr as arm-zephyr-eabi-gcc"
3232
exit 0
3333
}
3434

@@ -38,11 +38,15 @@ for arg in "$@"; do
3838
--et_build_root=*) et_build_root="${arg#*=}";;
3939
--build_type=*) build_type="${arg#*=}";;
4040
--portable_kernels=*) portable_kernels="${arg#*=}";;
41+
--toolchain=*) toolchain="${arg#*=}";;
4142
*)
4243
;;
4344
esac
4445
done
4546

47+
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake
48+
toolchain_cmake=$(realpath ${toolchain_cmake})
49+
4650
# Source the tools
4751
# This should be prepared by the setup.sh
4852
[[ -f ${setup_path_script} ]] \

examples/arm/run.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ memory_mode=""
3737
et_build_root="${et_root_dir}/arm_test"
3838
ethos_u_scratch_dir=${script_dir}/ethos-u-scratch
3939
scratch_dir_set=false
40+
toolchain=arm-non-eabi-gcc
4041

4142
function help() {
4243
echo "Usage: $(basename $0) [options]"
@@ -73,6 +74,7 @@ for arg in "$@"; do
7374
--no_quantize) aot_arm_compiler_flag_quantize="" ;;
7475
--portable_kernels=*) portable_kernels="${arg#*=}";;
7576
--target=*) target="${arg#*=}";;
77+
--toolchain=*) toolchain="${arg#*=}";;
7678
--output=*) output_folder="${arg#*=}" ; output_folder_set=true ;;
7779
--bundleio) bundleio=true ;;
7880
--etdump) build_with_etdump=true ;;
@@ -91,7 +93,7 @@ done
9193
# Default Ethos-u tool folder override with --scratch-dir=<FOLDER>
9294
ethos_u_scratch_dir=$(realpath ${ethos_u_scratch_dir})
9395
setup_path_script=${ethos_u_scratch_dir}/setup_path.sh
94-
toolchain_cmake=${script_dir}/ethos-u-setup/arm-none-eabi-gcc.cmake
96+
toolchain_cmake=${script_dir}/ethos-u-setup/${toolchain}.cmake
9597
_setup_msg="please refer to ${script_dir}/setup.sh to properly install necessary tools."
9698

9799

@@ -126,8 +128,8 @@ function check_setup () {
126128
fi
127129

128130
# If setup_path_script was correct all these checks should now pass
129-
hash arm-none-eabi-gcc \
130-
|| { echo "Could not find arm baremetal toolchain on PATH, ${_setup_msg}"; return 1; }
131+
hash ${toolchain} \
132+
|| { echo "Could not find ${toolchain} toolchain on PATH, ${_setup_msg}"; return 1; }
131133

132134
[[ -f ${toolchain_cmake} ]] \
133135
|| { echo "Could not find ${toolchain_cmake} file, ${_setup_msg}"; return 1; }
@@ -172,8 +174,8 @@ if [ "$bundleio" = true ] ; then
172174
et_dump_flag="--etdump"
173175
fi
174176

175-
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag
176-
backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels
177+
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag --toolchain="${toolchain}"
178+
backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels --toolchain="${toolchain}"
177179

178180
if [[ -z "$model_name" ]]; then
179181
# the test models run, and whether to delegate
@@ -257,7 +259,7 @@ for i in "${!test_model[@]}"; do
257259
else
258260
set -x
259261
# Rebuild the application as the pte is imported as a header/c array
260-
backends/arm/scripts/build_executor_runner.sh --et_build_root="${et_build_root}" --pte="${pte_file}" --build_type=${build_type} --target=${target} --system_config=${system_config} --memory_mode=${memory_mode} ${bundleio_flag} ${et_dump_flag} --extra_build_flags="${extra_build_flags}" --ethosu_tools_dir="${ethos_u_scratch_dir}"
262+
backends/arm/scripts/build_executor_runner.sh --et_build_root="${et_build_root}" --pte="${pte_file}" --build_type=${build_type} --target=${target} --system_config=${system_config} --memory_mode=${memory_mode} ${bundleio_flag} ${et_dump_flag} --extra_build_flags="${extra_build_flags}" --ethosu_tools_dir="${ethos_u_scratch_dir}" --toolchain="${toolchain}"
261263
if [ "$build_only" = false ] ; then
262264
# Execute the executor_runner on FVP Simulator
263265
elf_file="${output_folder}/${elf_folder}/cmake-out/arm_executor_runner"

0 commit comments

Comments
 (0)