Skip to content

Commit d3cd140

Browse files
committed
Removing other unneeded changes, update ci script to do correct command line arg parsing
1 parent 10ee866 commit d3cd140

File tree

5 files changed

+17
-52
lines changed

5 files changed

+17
-52
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Setup arm example environment (including TOSA tools)
99
git config --global user.email "[email protected]"
1010
git config --global user.name "Github Executorch"
11-
if [ "$#" -eq 0 ]; then
11+
if [ -z "$#"]; then
1212
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
1313
else
1414
bash examples/arm/setup.sh --i-agree-to-the-contained-eula "$#"

backends/arm/scripts/build_executor_runner.sh

Lines changed: 6 additions & 31 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=arm-none-eabi-gcc
12+
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
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,7 +46,6 @@ 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 zephyr as arm-zephyr-eabi-gcc"
5049
exit 0
5150
}
5251

@@ -64,15 +63,11 @@ for arg in "$@"; do
6463
--output=*) output_folder="${arg#*=}" ; output_folder_set=true ;;
6564
--et_build_root=*) et_build_root="${arg#*=}";;
6665
--ethosu_tools_dir=*) ethosu_tools_dir="${arg#*=}";;
67-
--toolchain=*) toolchain="${arg#*=}";;
6866
*)
6967
;;
7068
esac
7169
done
7270

73-
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake
74-
toolchain_cmake=$(realpath ${toolchain_cmake})
75-
7671
# Source the tools
7772
# This should be prepared by the setup.sh
7873
[[ -f ${setup_path_script} ]] \
@@ -121,7 +116,7 @@ else
121116
target_cpu=cortex-m85
122117
fi
123118
echo "--------------------------------------------------------------------------------"
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'"
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'"
125120
echo "--------------------------------------------------------------------------------"
126121

127122
cd ${et_root_dir}/examples/arm/executor_runner
@@ -135,27 +130,7 @@ if [ "$build_with_etdump" = true ] ; then
135130
fi
136131

137132
echo "Building with BundleIO/etdump/extra flags: ${build_bundleio_flags} ${build_with_etdump_flags} ${extra_build_flags}"
138-
echo "toolchain_cmake set to ${toolchain_cmake}"
139-
echo "$(pwd)"
140133

141-
echo "
142-
cmake \
143-
-DCMAKE_BUILD_TYPE=${build_type} \
144-
-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
145-
-DTARGET_CPU=${target_cpu} \
146-
-DET_DIR_PATH:PATH=${et_root_dir} \
147-
-DET_BUILD_DIR_PATH:PATH=${et_build_dir} \
148-
-DET_PTE_FILE_PATH:PATH="${pte_file}" \
149-
-DETHOS_SDK_PATH:PATH=${ethos_u_root_dir} \
150-
-DETHOSU_TARGET_NPU_CONFIG=${target} \
151-
${build_bundleio_flags} \
152-
${build_with_etdump_flags} \
153-
-DPYTHON_EXECUTABLE=$(which python3) \
154-
-DSYSTEM_CONFIG=${system_config} \
155-
-DMEMORY_MODE=${memory_mode} \
156-
${extra_build_flags} \
157-
-B ${output_folder}/cmake-out
158-
"
159134
cmake \
160135
-DCMAKE_BUILD_TYPE=${build_type} \
161136
-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
@@ -177,8 +152,8 @@ echo "[${BASH_SOURCE[0]}] Configured CMAKE"
177152

178153
cmake --build ${output_folder}/cmake-out -j$(nproc) -- arm_executor_runner
179154

180-
echo "[${BASH_SOURCE[0]}] Generated ${toolchain} elf file:"
155+
echo "[${BASH_SOURCE[0]}] Generated baremetal elf file:"
181156
find ${output_folder}/cmake-out -name "arm_executor_runner"
182-
echo "executable_text: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $1}') bytes"
183-
echo "executable_data: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $2}') bytes"
184-
echo "executable_bss: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $3}') bytes"
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"

backends/arm/scripts/build_executorch.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ 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=arm-none-eabi-gcc
16+
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
17+
toolchain_cmake=$(realpath ${toolchain_cmake})
1718
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1819
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
1920

@@ -29,7 +30,6 @@ help() {
2930
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}"
3031
echo " --devtools Build Devtools libs"
3132
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 zephyr as arm-zephyr-eabi-gcc"
3333
exit 0
3434
}
3535

@@ -40,15 +40,11 @@ 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#*=}";;
4443
*)
4544
;;
4645
esac
4746
done
4847

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

backends/arm/scripts/build_portable_kernels.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ 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=arm-none-eabi-gcc
16+
toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
17+
toolchain_cmake=$(realpath ${toolchain_cmake})
1718
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1819
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
1920

@@ -28,7 +29,6 @@ help() {
2829
echo " --et_build_root=<FOLDER> Build output root folder to use, defaults to ${et_build_root}"
2930
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}"
3031
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 zephyr as arm-zephyr-eabi-gcc"
3232
exit 0
3333
}
3434

@@ -38,15 +38,11 @@ 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#*=}";;
4241
*)
4342
;;
4443
esac
4544
done
4645

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

examples/arm/run.sh

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

4342
function help() {
4443
echo "Usage: $(basename $0) [options]"
@@ -76,7 +75,6 @@ for arg in "$@"; do
7675
--no_quantize) aot_arm_compiler_flag_quantize="" ;;
7776
--portable_kernels=*) portable_kernels="${arg#*=}";;
7877
--target=*) target="${arg#*=}";;
79-
--toolchain=*) toolchain="${arg#*=}";;
8078
--output=*) output_folder="${arg#*=}" ; output_folder_set=true ;;
8179
--bundleio) bundleio=true ;;
8280
--etdump) build_with_etdump=true ;;
@@ -96,7 +94,7 @@ done
9694
# Default Ethos-u tool folder override with --scratch-dir=<FOLDER>
9795
ethos_u_scratch_dir=$(realpath ${ethos_u_scratch_dir})
9896
setup_path_script=${ethos_u_scratch_dir}/setup_path.sh
99-
toolchain_cmake=${script_dir}/ethos-u-setup/${toolchain}.cmake
97+
toolchain_cmake=${script_dir}/ethos-u-setup/arm-none-eabi-gcc.cmake
10098
_setup_msg="please refer to ${script_dir}/setup.sh to properly install necessary tools."
10199

102100

@@ -136,8 +134,8 @@ function check_setup () {
136134
fi
137135

138136
# If setup_path_script was correct all these checks should now pass
139-
hash ${toolchain} \
140-
|| { echo "Could not find ${toolchain} toolchain on PATH, ${_setup_msg}"; return 1; }
137+
hash arm-none-eabi-gcc \
138+
|| { echo "Could not find arm baremetal toolchain on PATH, ${_setup_msg}"; return 1; }
141139

142140
[[ -f ${toolchain_cmake} ]] \
143141
|| { echo "Could not find ${toolchain_cmake} file, ${_setup_msg}"; return 1; }
@@ -182,8 +180,8 @@ if [ "$bundleio" = true ] ; then
182180
et_dump_flag="--etdump"
183181
fi
184182

185-
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag --toolchain="${toolchain}"
186-
backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels --toolchain="${toolchain}"
183+
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag
184+
backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels
187185

188186
if [[ -z "$model_name" ]]; then
189187
# the test models run, and whether to delegate
@@ -267,7 +265,7 @@ for i in "${!test_model[@]}"; do
267265
else
268266
set -x
269267
# Rebuild the application as the pte is imported as a header/c array
270-
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}"
268+
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}"
271269
if [ "$build_only" = false ] ; then
272270
# Execute the executor_runner on FVP Simulator
273271
elf_file="${output_folder}/${elf_folder}/cmake-out/arm_executor_runner"

0 commit comments

Comments
 (0)