Skip to content

Commit 85a0b7a

Browse files
committed
Attempting to revert to separate cmake version
1 parent bb2e579 commit 85a0b7a

File tree

6 files changed

+115
-24
lines changed

6 files changed

+115
-24
lines changed

.github/workflows/trunk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ jobs:
262262
263263
# We will use the the bare metal default, specify to use the
264264
# arm zephyr toolchain if we need to
265-
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
265+
toolchain_cmake=examples/arm/ethos-u-setup/${toolchain_prefix}gcc.cmake
266266
toolchain_cmake=$(realpath ${toolchain_cmake})
267267
268268
# Build and test size test
@@ -271,7 +271,7 @@ jobs:
271271
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
272272
CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out .
273273
cmake --build cmake-out -j9 --target install --config Release
274-
CXXFLAGS=${cxx_flags} cmake -DARM_TOOLCHAIN_NAME=zephyr -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
274+
CXXFLAGS=${cxx_flags} cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
275275
cmake --build cmake-out/test -j9 --config Release
276276
else
277277
echo "Fail unsupport OS selection ${{ matrix.os }}"

CMakePresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@
113113
],
114114
"cacheVariables": {
115115
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/zephyr.cmake",
116-
"ARM_TOOLCHAIN_NAME": "zephyr",
117-
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake"
116+
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/arm/ethos-u-setup/arm-zephyr-eabi-gcc.cmake"
118117
}
119118
}
120119
]

backends/arm/scripts/build_executorch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ help() {
2929
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}"
3030
echo " --devtools Build Devtools libs"
3131
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"
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

examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ set(TARGET_CPU
2525
)
2626
string(TOLOWER ${TARGET_CPU} CMAKE_SYSTEM_PROCESSOR)
2727

28-
if(ARM_TOOLCHAIN_NAME MATCHES "^zephyr")
29-
set(CMAKE_ARM_ARCH_ABI arm-zephyr-eabi)
30-
else()
31-
set(CMAKE_ARM_ARCH_ABI arm-none-eabi)
32-
endif()
33-
3428
set(CMAKE_SYSTEM_NAME Generic)
35-
set(CMAKE_C_COMPILER "${CMAKE_ARM_ARCH_ABI}-gcc")
36-
set(CMAKE_CXX_COMPILER "${CMAKE_ARM_ARCH_ABI}-g++")
37-
set(CMAKE_ASM_COMPILER "${CMAKE_ARM_ARCH_ABI}-gcc")
38-
set(CMAKE_LINKER "${CMAKE_ARM_ARCH_ABI}-ld")
29+
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
30+
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
31+
set(CMAKE_ASM_COMPILER "arm-none-eabi-gcc")
32+
set(CMAKE_LINKER "arm-none-eabi-ld")
3933

4034
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
4135
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
@@ -107,11 +101,3 @@ add_compile_options(
107101
-Wno-error=shift-count-overflow
108102
-Wno-psabi
109103
)
110-
111-
if(CMAKE_ARM_ARCH_ABI STREQUAL "arm-zephyr-eabi")
112-
add_compile_options(
113-
-Wno-stringop-overread
114-
-Wno-error=format=
115-
-Wno-error=maybe-uninitialized
116-
)
117-
endif()
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#
2+
# Copyright (c) 2020-2022 Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the License); you may
7+
# not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
14+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
# Copied this file from core_platform/cmake/toolchain/arm-non-eabi-gcc.cmake And
20+
# modified to align better with cs300 platform
21+
22+
set(TARGET_CPU
23+
"cortex-m55"
24+
CACHE STRING "Target CPU"
25+
)
26+
string(TOLOWER ${TARGET_CPU} CMAKE_SYSTEM_PROCESSOR)
27+
28+
set(CMAKE_SYSTEM_NAME Generic)
29+
set(CMAKE_C_COMPILER "arm-zephyr-eabi-gcc")
30+
set(CMAKE_CXX_COMPILER "arm-zephyr-eabi-g++")
31+
set(CMAKE_ASM_COMPILER "arm-zephyr-eabi-gcc")
32+
set(CMAKE_LINKER "arm-zephyr-eabi-ld")
33+
34+
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
35+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
36+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
37+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
38+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
39+
40+
# Select C/C++ version
41+
set(CMAKE_C_STANDARD 11)
42+
set(CMAKE_CXX_STANDARD 17)
43+
44+
set(GCC_CPU ${CMAKE_SYSTEM_PROCESSOR})
45+
string(REPLACE "cortex-m85" "cortex-m55" GCC_CPU ${GCC_CPU})
46+
47+
# Compile options
48+
add_compile_options(
49+
-mcpu=${GCC_CPU} -mthumb "$<$<CONFIG:DEBUG>:-gdwarf-3>"
50+
"$<$<COMPILE_LANGUAGE:CXX>:-fno-unwind-tables;-fno-rtti;-fno-exceptions>"
51+
-fdata-sections -ffunction-sections
52+
)
53+
54+
# Compile defines
55+
add_compile_definitions("$<$<NOT:$<CONFIG:DEBUG>>:NDEBUG>")
56+
57+
# Link options
58+
add_link_options(-mcpu=${GCC_CPU} -mthumb)
59+
60+
if(SEMIHOSTING)
61+
add_link_options(--specs=rdimon.specs)
62+
else()
63+
add_link_options(--specs=nosys.specs)
64+
endif()
65+
66+
# Set floating point unit
67+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+fp")
68+
set(FLOAT hard)
69+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+nofp")
70+
set(FLOAT soft)
71+
elseif(
72+
CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m33(\\+|$)"
73+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m55(\\+|$)"
74+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m85(\\+|$)"
75+
)
76+
set(FLOAT hard)
77+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m4(\\+|$)"
78+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "cortex-m7(\\+|$)"
79+
)
80+
set(FLOAT hard)
81+
set(FPU_CONFIG "fpv4-sp-d16")
82+
add_compile_options(-mfpu=${FPU_CONFIG})
83+
add_link_options(-mfpu=${FPU_CONFIG})
84+
else()
85+
set(FLOAT soft)
86+
endif()
87+
88+
if(FLOAT)
89+
add_compile_options(-mfloat-abi=${FLOAT})
90+
add_link_options(-mfloat-abi=${FLOAT})
91+
endif()
92+
93+
add_link_options(LINKER:--nmagic,--gc-sections)
94+
95+
# Compilation warnings
96+
add_compile_options(
97+
# -Wall -Wextra -Wcast-align -Wdouble-promotion -Wformat
98+
# -Wmissing-field-initializers -Wnull-dereference -Wredundant-decls -Wshadow
99+
# -Wswitch -Wswitch-default -Wunused -Wno-redundant-decls
100+
-Wno-stringop-overread
101+
-Wno-error=format=
102+
-Wno-error=maybe-uninitialized
103+
-Wno-error=deprecated-declarations
104+
-Wno-error=shift-count-overflow
105+
-Wno-psabi
106+
)

examples/arm/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ function select_toolchain() {
212212
toolchain_url="https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz"
213213
toolchain_dir="arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi"
214214
toolchain_md5_checksum="0601a9588bc5b9c99ad2b56133b7f118"
215-
echo "[main] Info using bare metal toolchain for default host OS ${OS} selection"
216215
fi
217216
else
218217
echo "[main] Error: only Linux is currently supported for x86-64 architecture now!"; exit 1;
@@ -241,6 +240,7 @@ function select_toolchain() {
241240
else
242241
echo "[main] Error: only x86-64 & aarch64/arm64 architecture is supported for now!"; exit 1;
243242
fi
243+
echo "[main] Info selected ${toolchain_dir} for ${ARCH} - ${OS} platform"
244244
}
245245
function setup_toolchain() {
246246
# Download and install the arm toolchain (default is arm-none-eabi)

0 commit comments

Comments
 (0)