@@ -49,7 +49,7 @@ check_command()
49
49
}
50
50
51
51
# Check if the current installation is a full SDK with all GNU toolchains
52
- check_full_sdk ()
52
+ check_full_gnu_sdk ()
53
53
{
54
54
for toolchain in ${gnu_toolchains[@]} ; do
55
55
if [ ! -d " gnu/${toolchain} " ]; then
@@ -67,6 +67,7 @@ usage()
67
67
echo
68
68
echo " -t <gnu_toolchain> Install specified GNU toolchain"
69
69
echo " all Install all GNU toolchains"
70
+ echo " -l Install LLVM toolchain"
70
71
echo " -h Install host tools"
71
72
echo " -c Register Zephyr SDK CMake package"
72
73
echo
@@ -89,20 +90,27 @@ user_prompt()
89
90
echo
90
91
91
92
# GNU Toolchains
92
- check_full_sdk
93
- if [ $? != 0 ]; then
94
- ask_yn " Install GNU toolchains for all targets"
95
- if [ $? == 0 ]; then
96
- inst_gnu_toolchains=(${gnu_toolchains[*]} )
97
- else
98
- for toolchain in ${gnu_toolchains[@]} ; do
99
- if [ ! -d " gnu/${toolchain} " ]; then
100
- ask_yn " Install '${toolchain} ' GNU toolchain" && inst_gnu_toolchains+=(" ${toolchain} " )
101
- fi
102
- done
93
+ ask_yn " Install GNU toolchain"
94
+ if [ $? == 0 ]; then
95
+ do_gnu_toolchain=" y"
96
+ check_full_gnu_sdk
97
+ if [ $? != 0 ]; then
98
+ ask_yn " Install GNU toolchains for all targets"
99
+ if [ $? == 0 ]; then
100
+ inst_gnu_toolchains=(${gnu_toolchains[*]} )
101
+ else
102
+ for toolchain in ${gnu_toolchains[@]} ; do
103
+ if [ ! -d " gnu/${toolchain} " ]; then
104
+ ask_yn " Install '${toolchain} ' GNU toolchain" && inst_gnu_toolchains+=(" ${toolchain} " )
105
+ fi
106
+ done
107
+ fi
103
108
fi
104
109
fi
105
110
111
+ # LLVM Toolchain
112
+ ask_yn " Install LLVM toolchain" && do_llvm_toolchain=" y"
113
+
106
114
# Host Tools
107
115
ask_yn " Install host tools" && do_hosttools=" y"
108
116
@@ -140,6 +148,10 @@ else
140
148
exit 2
141
149
fi
142
150
fi
151
+ do_gnu_toolchain=" y"
152
+ ;;
153
+ -l)
154
+ do_llvm_toolchain=" y"
143
155
;;
144
156
-h)
145
157
do_hosttools=" y"
187
199
# Resolve release download base URI
188
200
dl_rel_base=" https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${version} "
189
201
dl_gnu_toolchain_filename=' toolchain_gnu_${host}_${toolchain}.tar.xz'
202
+ dl_llvm_toolchain_filename=' toolchain_llvm_${host}.tar.xz'
190
203
191
204
# Print banner
192
205
echo " Zephyr SDK ${version} Setup"
@@ -203,38 +216,65 @@ if [ "${interactive}" = "y" ]; then
203
216
fi
204
217
205
218
# Install GNU toolchains
206
- mkdir -p gnu
207
- pushd gnu
219
+ if [ " ${do_gnu_toolchain} " = " y" ]; then
220
+ mkdir -p gnu
221
+ pushd gnu
208
222
209
- for toolchain in ${inst_gnu_toolchains[@]} ; do
210
- eval toolchain_filename=" ${dl_gnu_toolchain_filename} "
211
- toolchain_uri=" ${dl_rel_base} /${toolchain_filename} "
223
+ for toolchain in ${inst_gnu_toolchains[@]} ; do
224
+ eval toolchain_filename=" ${dl_gnu_toolchain_filename} "
225
+ toolchain_uri=" ${dl_rel_base} /${toolchain_filename} "
212
226
213
- # Skip if toolchain directory already exists
214
- if [ -d " ${toolchain} " ]; then
215
- continue
216
- fi
227
+ # Skip if toolchain directory already exists
228
+ if [ -d " ${toolchain} " ]; then
229
+ continue
230
+ fi
231
+
232
+ echo " Installing '${toolchain} ' GNU toolchain ..."
233
+
234
+ # Download toolchain archive
235
+ wget -q --show-progress -N -O " ${toolchain_filename} " " ${toolchain_uri} "
236
+ if [ $? != 0 ]; then
237
+ rm -f " ${toolchain_filename} "
238
+ echo " ERROR: GNU toolchain download failed"
239
+ exit 20
240
+ fi
217
241
218
- echo " Installing '${toolchain} ' GNU toolchain ..."
242
+ # Extract archive
243
+ tar xf " ${toolchain_filename} "
244
+ assert_rc " ERROR: GNU toolchain archive extraction failed" 21
245
+
246
+ # Remove archive
247
+ rm -f " ${toolchain_filename} "
248
+
249
+ echo
250
+ done
251
+ popd
252
+ fi
253
+
254
+ # Install LLVM toolchain
255
+ if [ " ${do_llvm_toolchain} " = " y" ] && [ ! -d " llvm" ]; then
256
+ echo " Installing LLVM toolchain ..."
257
+
258
+ eval toolchain_filename=" ${dl_llvm_toolchain_filename} "
259
+ toolchain_uri=" ${dl_rel_base} /${toolchain_filename} "
219
260
220
261
# Download toolchain archive
221
262
wget -q --show-progress -N -O " ${toolchain_filename} " " ${toolchain_uri} "
222
263
if [ $? != 0 ]; then
223
264
rm -f " ${toolchain_filename} "
224
- echo " ERROR: GNU toolchain download failed"
265
+ echo " ERROR: LLVM toolchain download failed"
225
266
exit 20
226
267
fi
227
268
228
269
# Extract archive
229
270
tar xf " ${toolchain_filename} "
230
- assert_rc " ERROR: GNU toolchain archive extraction failed" 21
271
+ assert_rc " ERROR: LLVM toolchain archive extraction failed" 21
231
272
232
273
# Remove archive
233
274
rm -f " ${toolchain_filename} "
234
275
235
276
echo
236
- done
237
- popd
277
+ fi
238
278
239
279
# Install host tools
240
280
if [ " ${do_hosttools} " = " y" ]; then
0 commit comments