Skip to content

Commit 312f0a9

Browse files
committed
Restore current Zephyr compatibility
This patch restores the abilty to use this SDK without any changes to Zephyr. It moves the GNU toolchains back to the top level, places hosttools at the top level and moves the cmake/zephyr/gnu files back to cmake/zephyr. The goal is to change the sequencing of the restructuring to ease migration. Instead of requiring synchronous changes between SDK and Zephyr, we'll plan on updating Zephyr with the ability to handle either structure, then modify the SDK structure once Zephyr is ready. Signed-off-by: Keith Packard <keithp@keithp.com>
1 parent 45f4f7f commit 312f0a9

File tree

5 files changed

+20
-31
lines changed

5 files changed

+20
-31
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,7 @@ jobs:
14671467
fi
14681468
14691469
# Stage GNU toolchains
1470-
mkdir ${ARCHIVE_DIR}/gnu
1471-
pushd ${ARCHIVE_DIR}/gnu
1470+
pushd ${ARCHIVE_DIR}
14721471
14731472
## Generate target list from the workflow matrix
14741473
TARGETS=$(echo '${{ needs.setup.outputs.targets }}' | jq -cr '.[]')
@@ -1497,8 +1496,10 @@ jobs:
14971496
7z a -t7z -l ${ARCHIVE_NAME}_gnu.${EXT} ${ARCHIVE_DIR}
14981497
fi
14991498
1500-
# Unstage GNU toolchain directory
1501-
rm -rf ${ARCHIVE_DIR}/gnu
1499+
# Unstage GNU toolchain directories
1500+
for TARGET in ${TARGETS}; do
1501+
rm -rf ${ARCHIVE_DIR}/${TARGET}
1502+
done
15021503
15031504
# Stage LLVM toolchains
15041505
pushd ${ARCHIVE_DIR}

cmake/zephyr/gnu/generic.cmake renamed to cmake/zephyr/generic.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR}/gnu)
3+
set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR})
44

55
set(COMPILER gcc)
66
set(LINKER ld)

cmake/zephyr/gnu/target.cmake renamed to cmake/zephyr/target.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ set(CROSS_COMPILE_TARGET_sparc sparc-zephyr-elf)
2727
set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
2828
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
2929

30-
set(SYSROOT_DIR ${ZEPHYR_SDK_INSTALL_DIR}/gnu/${SYSROOT_TARGET}/${SYSROOT_TARGET})
31-
set(CROSS_COMPILE ${ZEPHYR_SDK_INSTALL_DIR}/gnu/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
30+
set(SYSROOT_DIR ${ZEPHYR_SDK_INSTALL_DIR}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
31+
set(CROSS_COMPILE ${ZEPHYR_SDK_INSTALL_DIR}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
3232

3333
if("${ARCH}" STREQUAL "x86")
3434
if(CONFIG_X86_64)

scripts/template_setup_posix

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ check_command()
5252
check_full_gnu_sdk()
5353
{
5454
for toolchain in ${gnu_toolchains[@]}; do
55-
if [ ! -d "gnu/${toolchain}" ]; then
55+
if [ ! -d "${toolchain}" ]; then
5656
return 1
5757
fi
5858
done
@@ -101,7 +101,7 @@ user_prompt()
101101
inst_gnu_toolchains=(${gnu_toolchains[*]})
102102
else
103103
for toolchain in ${gnu_toolchains[@]}; do
104-
if [ ! -d "gnu/${toolchain}" ]; then
104+
if [ ! -d "${toolchain}" ]; then
105105
ask_yn "Install '${toolchain}' GNU toolchain" && inst_gnu_toolchains+=("${toolchain}")
106106
fi
107107
done
@@ -118,8 +118,6 @@ user_prompt()
118118
# Environment Configurations
119119
ask_yn "Register Zephyr SDK CMake package" && do_cmake_pkg="y"
120120

121-
ask_yn "Create symbolic links for old Zephyr bisectability" && do_old_zephyr="y"
122-
123121
echo
124122
}
125123

@@ -211,6 +209,13 @@ dl_llvm_toolchain_filename='toolchain_llvm_${host}.tar.xz'
211209
echo "Zephyr SDK ${version} Setup"
212210
echo
213211

212+
# Move anything left in gnu/ to here. This won't be
213+
# needed once the CI script is updated
214+
if [ -d gnu ]; then
215+
mv gnu/* .
216+
rmdir gnu
217+
fi
218+
214219
# Check dependencies
215220
check_command cmake 90
216221
[[ "${host}" =~ ^linux-.* ]] && check_command wget 91
@@ -235,8 +240,6 @@ fi
235240

236241
# Install GNU toolchains
237242
if [ "${do_gnu_toolchain}" = "y" ]; then
238-
mkdir -p gnu
239-
pushd gnu
240243

241244
for toolchain in ${inst_gnu_toolchains[@]}; do
242245
eval toolchain_filename="${dl_gnu_toolchain_filename}"
@@ -266,7 +269,6 @@ if [ "${do_gnu_toolchain}" = "y" ]; then
266269

267270
echo
268271
done
269-
popd
270272
fi
271273

272274
# Install LLVM toolchain
@@ -299,10 +301,8 @@ if [ "${do_hosttools}" = "y" ]; then
299301
echo "Installing host tools ..."
300302
case ${host} in
301303
linux-*)
302-
pushd hosttools
303-
./zephyr-sdk-${HOSTTYPE}-hosttools-standalone-0.10.sh -y -d . &> /dev/null
304+
./hosttools/zephyr-sdk-${HOSTTYPE}-hosttools-standalone-0.10.sh -y -d . &> /dev/null
304305
assert_rc "ERROR: Host tools installation failed" 30
305-
popd
306306
;;
307307
macos-*)
308308
echo "SKIPPED: macOS host tools are not available yet."
@@ -319,15 +319,6 @@ if [ "${do_cmake_pkg}" = "y" ]; then
319319
echo
320320
fi
321321

322-
# Create links for old Zephyr versions
323-
if [ "${do_old_zephyr}" = "y" ]; then
324-
echo "Creating links for old Zephyr bisectability ..."
325-
ln -sr gnu/* . || assert_rc "ERROR: Creating toolchain links" 50
326-
ln -sr cmake/zephyr/gnu/* cmake/zephyr || assert_rc "ERROR: Creating cmake links" 50
327-
ln -sr hosttools/* . || assert_rc "ERROR: Creating hosttools links" 50
328-
echo
329-
fi
330-
331322
echo "All done."
332323
if [ "${interactive}" = "y" ]; then
333324
read -n 1 -s -r -p "Press any key to exit ..."

scripts/template_setup_win

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ echo.
109109

110110
REM # Check installation type
111111
for %%t in (%GNU_TOOLCHAINS%) do (
112-
if not exist gnu\%%t\ (
112+
if not exist %%t\ (
113113
set IS_PARTIAL_GNU_SDK=y
114114
)
115115
)
@@ -124,7 +124,7 @@ if [!ERRORLEVEL!] equ [1] (
124124
set INST_GNU_TOOLCHAINS=%GNU_TOOLCHAINS%
125125
) else (
126126
for %%t in (%GNU_TOOLCHAINS%) do (
127-
if not exist gnu\%%t\ (
127+
if not exist %%t\ (
128128
choice /c:yn /m:"Install '%%t' GNU toolchain"
129129
if [!ERRORLEVEL!] equ [1] (
130130
set INST_GNU_TOOLCHAINS=!INST_GNU_TOOLCHAINS! %%t
@@ -149,8 +149,6 @@ echo.
149149
:process
150150
REM # Install GNU toolchains
151151
if [%DO_GNU_TOOLCHAIN%] neq [] (
152-
if not exist gnu\ mkdir gnu
153-
pushd gnu
154152

155153
for %%t in (%INST_GNU_TOOLCHAINS%) do (
156154
set TOOLCHAIN_FILENAME=%DL_GNU_TOOLCHAIN_FILENAME%
@@ -180,7 +178,6 @@ if [%DO_GNU_TOOLCHAIN%] neq [] (
180178
del /q !TOOLCHAIN_FILENAME!
181179
)
182180
)
183-
popd
184181
)
185182

186183
REM # Install LLVM toolchain

0 commit comments

Comments
 (0)