From 3dcff43c2168892427a76bcba66cbd45eb713da0 Mon Sep 17 00:00:00 2001 From: BujSet Date: Fri, 27 Jun 2025 23:03:17 +0000 Subject: [PATCH 1/5] Plumbing to allow arm example runnner to use command line parameter zephyr toolchain when possible --- backends/arm/scripts/build_executor_runner.sh | 18 +-- backends/arm/scripts/build_executorch.sh | 8 +- .../arm/scripts/build_portable_kernels.sh | 8 +- .../ethos-u-setup/arm-zephyr-eabi-gcc.cmake | 106 ++++++++++++++++++ examples/arm/run.sh | 14 ++- 5 files changed, 137 insertions(+), 17 deletions(-) create mode 100644 examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake diff --git a/backends/arm/scripts/build_executor_runner.sh b/backends/arm/scripts/build_executor_runner.sh index 9e2f3954c53..9d1ca413cd4 100755 --- a/backends/arm/scripts/build_executor_runner.sh +++ b/backends/arm/scripts/build_executor_runner.sh @@ -9,7 +9,7 @@ set -eu script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) et_root_dir=$(cd ${script_dir}/../../.. && pwd) et_root_dir=$(realpath ${et_root_dir}) -toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake +toolchain=arm-none-eabi-gcc setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh _setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools." @@ -46,6 +46,7 @@ help() { echo " --output= Output folder Default: /_.pte" echo " --et_build_root= Build output root folder to use, defaults to ${et_build_root}" echo " --ethosu_tools_dir= Path to your Ethos-U tools dir if you not using default: ${ethosu_tools_dir}" + echo " --toolchain= Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zephyr as arm-zephyr-eabi-gcc" exit 0 } @@ -63,11 +64,15 @@ for arg in "$@"; do --output=*) output_folder="${arg#*=}" ; output_folder_set=true ;; --et_build_root=*) et_build_root="${arg#*=}";; --ethosu_tools_dir=*) ethosu_tools_dir="${arg#*=}";; + --toolchain=*) toolchain="${arg#*=}";; *) ;; esac done +toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +toolchain_cmake=$(realpath ${toolchain_cmake}) + # Source the tools # This should be prepared by the setup.sh [[ -f ${setup_path_script} ]] \ @@ -116,7 +121,7 @@ else target_cpu=cortex-m85 fi echo "--------------------------------------------------------------------------------" -echo "Build Arm Baremetal executor_runner for ${target} with ${pte_file} using ${system_config} ${memory_mode} ${extra_build_flags} to '${output_folder}/cmake-out'" +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'" echo "--------------------------------------------------------------------------------" cd ${et_root_dir}/examples/arm/executor_runner @@ -130,7 +135,6 @@ if [ "$build_with_etdump" = true ] ; then fi echo "Building with BundleIO/etdump/extra flags: ${build_bundleio_flags} ${build_with_etdump_flags} ${extra_build_flags}" - cmake \ -DCMAKE_BUILD_TYPE=${build_type} \ -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \ @@ -152,8 +156,8 @@ echo "[${BASH_SOURCE[0]}] Configured CMAKE" cmake --build ${output_folder}/cmake-out -j$(nproc) -- arm_executor_runner -echo "[${BASH_SOURCE[0]}] Generated baremetal elf file:" +echo "[${BASH_SOURCE[0]}] Generated ${toolchain} elf file:" find ${output_folder}/cmake-out -name "arm_executor_runner" -echo "executable_text: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $1}') bytes" -echo "executable_data: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $2}') bytes" -echo "executable_bss: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec arm-none-eabi-size {} \; | grep -v filename | awk '{print $3}') bytes" +echo "executable_text: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $1}') bytes" +echo "executable_data: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $2}') bytes" +echo "executable_bss: $(find ${output_folder}/cmake-out -name arm_executor_runner -exec ${toolchain/-gcc/-size} {} \; | grep -v filename | awk '{print $3}') bytes" diff --git a/backends/arm/scripts/build_executorch.sh b/backends/arm/scripts/build_executorch.sh index cb2b48a644d..a87ae9dc375 100755 --- a/backends/arm/scripts/build_executorch.sh +++ b/backends/arm/scripts/build_executorch.sh @@ -13,8 +13,7 @@ set -eu script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) et_root_dir=$(cd ${script_dir}/../../.. && pwd) et_root_dir=$(realpath ${et_root_dir}) -toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake -toolchain_cmake=$(realpath ${toolchain_cmake}) +toolchain=arm-none-eabi-gcc setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh _setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools." @@ -30,6 +29,7 @@ help() { echo " --build_type= Build with Release, Debug or RelWithDebInfo, default is ${build_type}" echo " --devtools Build Devtools libs" echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log" + echo " --toolchain= Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zephyr as arm-zephyr-eabi-gcc" exit 0 } @@ -40,11 +40,15 @@ for arg in "$@"; do --build_type=*) build_type="${arg#*=}";; --devtools) build_devtools=true ;; --etdump) build_with_etdump=true ;; + --toolchain=*) toolchain="${arg#*=}";; *) ;; esac done +toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake +toolchain_cmake=$(realpath ${toolchain_cmake}) + # Source the tools # This should be prepared by the setup.sh [[ -f ${setup_path_script} ]] \ diff --git a/backends/arm/scripts/build_portable_kernels.sh b/backends/arm/scripts/build_portable_kernels.sh index 2719fbb603e..ff6313a4694 100755 --- a/backends/arm/scripts/build_portable_kernels.sh +++ b/backends/arm/scripts/build_portable_kernels.sh @@ -13,8 +13,7 @@ set -eu script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) et_root_dir=$(cd ${script_dir}/../../.. && pwd) et_root_dir=$(realpath ${et_root_dir}) -toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake -toolchain_cmake=$(realpath ${toolchain_cmake}) +toolchain=arm-none-eabi-gcc setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh _setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools." @@ -29,6 +28,7 @@ help() { echo " --et_build_root= Build output root folder to use, defaults to ${et_build_root}" echo " --build_type= Build with Release, Debug or RelWithDebInfo, default is ${build_type}" echo " --portable_kernels= Comma separated list of portable (non delagated) kernels to include Default: ${portable_kernels}" + echo " --toolchain= Toolchain can be specified (e.g. bare metal as arm-none-eabi-gcc or zephyr as arm-zephyr-eabi-gcc" exit 0 } @@ -38,11 +38,15 @@ for arg in "$@"; do --et_build_root=*) et_build_root="${arg#*=}";; --build_type=*) build_type="${arg#*=}";; --portable_kernels=*) portable_kernels="${arg#*=}";; + --toolchain=*) toolchain="${arg#*=}";; *) ;; esac done +toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake +toolchain_cmake=$(realpath ${toolchain_cmake}) + # Source the tools # This should be prepared by the setup.sh [[ -f ${setup_path_script} ]] \ diff --git a/examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake b/examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake new file mode 100644 index 00000000000..8e1a478a6cb --- /dev/null +++ b/examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake @@ -0,0 +1,106 @@ +# +# Copyright (c) 2020-2022 Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the License); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Copied this file from core_platform/cmake/toolchain/arm-non-eabi-gcc.cmake And +# modified to align better with cs300 platform + +set(TARGET_CPU + "cortex-m55" + CACHE STRING "Target CPU" +) +string(TOLOWER ${TARGET_CPU} CMAKE_SYSTEM_PROCESSOR) + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_C_COMPILER "arm-zephyr-eabi-gcc") +set(CMAKE_CXX_COMPILER "arm-zephyr-eabi-g++") +set(CMAKE_ASM_COMPILER "arm-zephyr-eabi-gcc") +set(CMAKE_LINKER "arm-zephyr-eabi-ld") + +set(CMAKE_EXECUTABLE_SUFFIX ".elf") +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Select C/C++ version +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(GCC_CPU ${CMAKE_SYSTEM_PROCESSOR}) +string(REPLACE "cortex-m85" "cortex-m55" GCC_CPU ${GCC_CPU}) + +# Compile options +add_compile_options( + -mcpu=${GCC_CPU} -mthumb "$<$:-gdwarf-3>" + "$<$:-fno-unwind-tables;-fno-rtti;-fno-exceptions>" + -fdata-sections -ffunction-sections +) + +# Compile defines +add_compile_definitions("$<$>:NDEBUG>") + +# Link options +add_link_options(-mcpu=${GCC_CPU} -mthumb) + +if(SEMIHOSTING) + add_link_options(--specs=rdimon.specs) +else() + add_link_options(--specs=nosys.specs) +endif() + +# Set floating point unit +if(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+fp") + set(FLOAT hard) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+nofp") + set(FLOAT soft) +elseif( + CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m33(\\+|$)" + OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m55(\\+|$)" + OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m85(\\+|$)" +) + set(FLOAT hard) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m4(\\+|$)" + OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m7(\\+|$)" +) + set(FLOAT hard) + set(FPU_CONFIG "fpv4-sp-d16") + add_compile_options(-mfpu=${FPU_CONFIG}) + add_link_options(-mfpu=${FPU_CONFIG}) +else() + set(FLOAT soft) +endif() + +if(FLOAT) + add_compile_options(-mfloat-abi=${FLOAT}) + add_link_options(-mfloat-abi=${FLOAT}) +endif() + +add_link_options(LINKER:--nmagic,--gc-sections) + +# Compilation warnings +add_compile_options( + # -Wall -Wextra -Wcast-align -Wdouble-promotion -Wformat + # -Wmissing-field-initializers -Wnull-dereference -Wredundant-decls -Wshadow + # -Wswitch -Wswitch-default -Wunused -Wno-redundant-decls + -Wno-stringop-overread + -Wno-error=format= + -Wno-error=maybe-uninitialized + -Wno-error=deprecated-declarations + -Wno-error=shift-count-overflow + -Wno-psabi +) diff --git a/examples/arm/run.sh b/examples/arm/run.sh index 797739e3cd2..15ce4d6e8d9 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -38,6 +38,7 @@ memory_mode="" et_build_root="${et_root_dir}/arm_test" ethos_u_scratch_dir=${script_dir}/ethos-u-scratch scratch_dir_set=false +toolchain=arm-none-eabi-gcc function help() { echo "Usage: $(basename $0) [options]" @@ -75,6 +76,7 @@ for arg in "$@"; do --no_quantize) aot_arm_compiler_flag_quantize="" ;; --portable_kernels=*) portable_kernels="${arg#*=}";; --target=*) target="${arg#*=}";; + --toolchain=*) toolchain="${arg#*=}";; --output=*) output_folder="${arg#*=}" ; output_folder_set=true ;; --bundleio) bundleio=true ;; --etdump) build_with_etdump=true ;; @@ -94,7 +96,7 @@ done # Default Ethos-u tool folder override with --scratch-dir= ethos_u_scratch_dir=$(realpath ${ethos_u_scratch_dir}) setup_path_script=${ethos_u_scratch_dir}/setup_path.sh -toolchain_cmake=${script_dir}/ethos-u-setup/arm-none-eabi-gcc.cmake +toolchain_cmake=${script_dir}/ethos-u-setup/${toolchain}.cmake _setup_msg="please refer to ${script_dir}/setup.sh to properly install necessary tools." @@ -134,8 +136,8 @@ function check_setup () { fi # If setup_path_script was correct all these checks should now pass - hash arm-none-eabi-gcc \ - || { echo "Could not find arm baremetal toolchain on PATH, ${_setup_msg}"; return 1; } + hash ${toolchain} \ + || { echo "Could not find ${toolchain} toolchain on PATH, ${_setup_msg}"; return 1; } [[ -f ${toolchain_cmake} ]] \ || { echo "Could not find ${toolchain_cmake} file, ${_setup_msg}"; return 1; } @@ -180,8 +182,8 @@ if [ "$bundleio" = true ] ; then et_dump_flag="--etdump" fi -backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag -backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels +backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag --toolchain="${toolchain}" +backends/arm/scripts/build_portable_kernels.sh --et_build_root="${et_build_root}" --build_type=$build_type --portable_kernels=$portable_kernels --toolchain="${toolchain}" if [[ -z "$model_name" ]]; then # the test models run, and whether to delegate @@ -265,7 +267,7 @@ for i in "${!test_model[@]}"; do else set -x # Rebuild the application as the pte is imported as a header/c array - 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}" + 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}" if [ "$build_only" = false ] ; then # Execute the executor_runner on FVP Simulator elf_file="${output_folder}/${elf_folder}/cmake-out/arm_executor_runner" From be13fce8a9851817768c0d3badec1e2f36b47a95 Mon Sep 17 00:00:00 2001 From: BujSet Date: Tue, 1 Jul 2025 18:28:10 +0000 Subject: [PATCH 2/5] Updating changes to remove coupling between zephyr and arm ethos-u --- backends/arm/scripts/build_executor_runner.sh | 12 ++++++++++-- backends/arm/scripts/build_executorch.sh | 10 +++++++++- backends/arm/scripts/build_portable_kernels.sh | 10 +++++++++- examples/arm/run.sh | 11 ++++++++++- .../arm-x86-64-gcc.cmake} | 0 5 files changed, 38 insertions(+), 5 deletions(-) rename examples/{arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake => zephyr/arm-x86-64-gcc.cmake} (100%) diff --git a/backends/arm/scripts/build_executor_runner.sh b/backends/arm/scripts/build_executor_runner.sh index 9d1ca413cd4..9a1b0c611af 100755 --- a/backends/arm/scripts/build_executor_runner.sh +++ b/backends/arm/scripts/build_executor_runner.sh @@ -64,13 +64,21 @@ for arg in "$@"; do --output=*) output_folder="${arg#*=}" ; output_folder_set=true ;; --et_build_root=*) et_build_root="${arg#*=}";; --ethosu_tools_dir=*) ethosu_tools_dir="${arg#*=}";; - --toolchain=*) toolchain="${arg#*=}";; + --toolchain=*) toolchain="${arg#*=}"; toolchain=arm-none-eabi-gcc; *) ;; esac done -toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake +else + echo "Error: Invalid toolchain selection, provided: ${tolchain}" + echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" + exit 1; +fi toolchain_cmake=$(realpath ${toolchain_cmake}) # Source the tools diff --git a/backends/arm/scripts/build_executorch.sh b/backends/arm/scripts/build_executorch.sh index a87ae9dc375..a25bbb1e994 100755 --- a/backends/arm/scripts/build_executorch.sh +++ b/backends/arm/scripts/build_executorch.sh @@ -46,7 +46,15 @@ for arg in "$@"; do esac done -toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake +if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake +else + echo "Error: Invalid toolchain selection, provided: ${tolchain}" + echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" + exit 1; +fi toolchain_cmake=$(realpath ${toolchain_cmake}) # Source the tools diff --git a/backends/arm/scripts/build_portable_kernels.sh b/backends/arm/scripts/build_portable_kernels.sh index ff6313a4694..100b75578e0 100755 --- a/backends/arm/scripts/build_portable_kernels.sh +++ b/backends/arm/scripts/build_portable_kernels.sh @@ -44,7 +44,15 @@ for arg in "$@"; do esac done -toolchain_cmake=${script_dir}/../../../examples/arm/ethos-u-setup/${toolchain}.cmake +if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake +else + echo "Error: Invalid toolchain selection, provided: ${tolchain}" + echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" + exit 1; +fi toolchain_cmake=$(realpath ${toolchain_cmake}) # Source the tools diff --git a/examples/arm/run.sh b/examples/arm/run.sh index 15ce4d6e8d9..315c71d4381 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -96,7 +96,16 @@ done # Default Ethos-u tool folder override with --scratch-dir= ethos_u_scratch_dir=$(realpath ${ethos_u_scratch_dir}) setup_path_script=${ethos_u_scratch_dir}/setup_path.sh -toolchain_cmake=${script_dir}/ethos-u-setup/${toolchain}.cmake +if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake +elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then + toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake +else + echo "Error: Invalid toolchain selection, provided: ${tolchain}" + echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" + exit 1; +fi +toolchain_cmake=$(realpath ${toolchain_cmake}) _setup_msg="please refer to ${script_dir}/setup.sh to properly install necessary tools." diff --git a/examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake b/examples/zephyr/arm-x86-64-gcc.cmake similarity index 100% rename from examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake rename to examples/zephyr/arm-x86-64-gcc.cmake From fe3919d8a1eabde4a41ac50761862608bafe6027 Mon Sep 17 00:00:00 2001 From: BujSet Date: Wed, 2 Jul 2025 14:03:02 +0000 Subject: [PATCH 3/5] Removing duplicate setting of default value --- backends/arm/scripts/build_executor_runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/arm/scripts/build_executor_runner.sh b/backends/arm/scripts/build_executor_runner.sh index 9a1b0c611af..6e01f0ad320 100755 --- a/backends/arm/scripts/build_executor_runner.sh +++ b/backends/arm/scripts/build_executor_runner.sh @@ -64,7 +64,7 @@ for arg in "$@"; do --output=*) output_folder="${arg#*=}" ; output_folder_set=true ;; --et_build_root=*) et_build_root="${arg#*=}";; --ethosu_tools_dir=*) ethosu_tools_dir="${arg#*=}";; - --toolchain=*) toolchain="${arg#*=}"; toolchain=arm-none-eabi-gcc; + --toolchain=*) toolchain="${arg#*=}";; *) ;; esac From 50b7bd962ad1f7759d9d0fa91e7e36a51b1cc0de Mon Sep 17 00:00:00 2001 From: BujSet Date: Thu, 3 Jul 2025 12:58:10 +0000 Subject: [PATCH 4/5] Fixing due to rebase --- backends/arm/scripts/build_executor_runner.sh | 2 +- backends/arm/scripts/build_executorch.sh | 2 +- .../arm/scripts/build_portable_kernels.sh | 2 +- examples/arm/run.sh | 2 +- examples/zephyr/arm-x86-64-gcc.cmake | 106 ------------------ 5 files changed, 4 insertions(+), 110 deletions(-) delete mode 100644 examples/zephyr/arm-x86-64-gcc.cmake diff --git a/backends/arm/scripts/build_executor_runner.sh b/backends/arm/scripts/build_executor_runner.sh index 6e01f0ad320..974c5ca1ff7 100755 --- a/backends/arm/scripts/build_executor_runner.sh +++ b/backends/arm/scripts/build_executor_runner.sh @@ -73,7 +73,7 @@ done if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then - toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake + toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Error: Invalid toolchain selection, provided: ${tolchain}" echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" diff --git a/backends/arm/scripts/build_executorch.sh b/backends/arm/scripts/build_executorch.sh index a25bbb1e994..c66eeea4ca9 100755 --- a/backends/arm/scripts/build_executorch.sh +++ b/backends/arm/scripts/build_executorch.sh @@ -49,7 +49,7 @@ done if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then - toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake + toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Error: Invalid toolchain selection, provided: ${tolchain}" echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" diff --git a/backends/arm/scripts/build_portable_kernels.sh b/backends/arm/scripts/build_portable_kernels.sh index 100b75578e0..0d06b59dd03 100755 --- a/backends/arm/scripts/build_portable_kernels.sh +++ b/backends/arm/scripts/build_portable_kernels.sh @@ -47,7 +47,7 @@ done if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then - toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake + toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Error: Invalid toolchain selection, provided: ${tolchain}" echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" diff --git a/examples/arm/run.sh b/examples/arm/run.sh index 315c71d4381..a1453ae64d5 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -99,7 +99,7 @@ setup_path_script=${ethos_u_scratch_dir}/setup_path.sh if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then - toolchain_cmake=${et_root_dir}/examples/zephyr/arm-x86-64-gcc.cmake + toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zpehyr-eabi-gcc.cmake else echo "Error: Invalid toolchain selection, provided: ${tolchain}" echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}" diff --git a/examples/zephyr/arm-x86-64-gcc.cmake b/examples/zephyr/arm-x86-64-gcc.cmake deleted file mode 100644 index 8e1a478a6cb..00000000000 --- a/examples/zephyr/arm-x86-64-gcc.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright (c) 2020-2022 Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the License); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an AS IS BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Copied this file from core_platform/cmake/toolchain/arm-non-eabi-gcc.cmake And -# modified to align better with cs300 platform - -set(TARGET_CPU - "cortex-m55" - CACHE STRING "Target CPU" -) -string(TOLOWER ${TARGET_CPU} CMAKE_SYSTEM_PROCESSOR) - -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_C_COMPILER "arm-zephyr-eabi-gcc") -set(CMAKE_CXX_COMPILER "arm-zephyr-eabi-g++") -set(CMAKE_ASM_COMPILER "arm-zephyr-eabi-gcc") -set(CMAKE_LINKER "arm-zephyr-eabi-ld") - -set(CMAKE_EXECUTABLE_SUFFIX ".elf") -set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -# Select C/C++ version -set(CMAKE_C_STANDARD 11) -set(CMAKE_CXX_STANDARD 17) - -set(GCC_CPU ${CMAKE_SYSTEM_PROCESSOR}) -string(REPLACE "cortex-m85" "cortex-m55" GCC_CPU ${GCC_CPU}) - -# Compile options -add_compile_options( - -mcpu=${GCC_CPU} -mthumb "$<$:-gdwarf-3>" - "$<$:-fno-unwind-tables;-fno-rtti;-fno-exceptions>" - -fdata-sections -ffunction-sections -) - -# Compile defines -add_compile_definitions("$<$>:NDEBUG>") - -# Link options -add_link_options(-mcpu=${GCC_CPU} -mthumb) - -if(SEMIHOSTING) - add_link_options(--specs=rdimon.specs) -else() - add_link_options(--specs=nosys.specs) -endif() - -# Set floating point unit -if(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+fp") - set(FLOAT hard) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+nofp") - set(FLOAT soft) -elseif( - CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m33(\\+|$)" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m55(\\+|$)" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m85(\\+|$)" -) - set(FLOAT hard) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m4(\\+|$)" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m7(\\+|$)" -) - set(FLOAT hard) - set(FPU_CONFIG "fpv4-sp-d16") - add_compile_options(-mfpu=${FPU_CONFIG}) - add_link_options(-mfpu=${FPU_CONFIG}) -else() - set(FLOAT soft) -endif() - -if(FLOAT) - add_compile_options(-mfloat-abi=${FLOAT}) - add_link_options(-mfloat-abi=${FLOAT}) -endif() - -add_link_options(LINKER:--nmagic,--gc-sections) - -# Compilation warnings -add_compile_options( - # -Wall -Wextra -Wcast-align -Wdouble-promotion -Wformat - # -Wmissing-field-initializers -Wnull-dereference -Wredundant-decls -Wshadow - # -Wswitch -Wswitch-default -Wunused -Wno-redundant-decls - -Wno-stringop-overread - -Wno-error=format= - -Wno-error=maybe-uninitialized - -Wno-error=deprecated-declarations - -Wno-error=shift-count-overflow - -Wno-psabi -) From 7ae07c6af878ee6fd458fd11a7d5ecf1869d407a Mon Sep 17 00:00:00 2001 From: BujSet Date: Thu, 3 Jul 2025 13:33:45 +0000 Subject: [PATCH 5/5] typo fix --- examples/arm/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/arm/run.sh b/examples/arm/run.sh index a1453ae64d5..389a69bc0c6 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -99,7 +99,7 @@ setup_path_script=${ethos_u_scratch_dir}/setup_path.sh if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then - toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zpehyr-eabi-gcc.cmake + toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Error: Invalid toolchain selection, provided: ${tolchain}" echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}"