@@ -38,6 +38,7 @@ set /p VERSION=<sdk_version
38
38
REM # Resolve release download base URI
39
39
set DL_REL_BASE=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v%VERSION%
40
40
set DL_GNU_TOOLCHAIN_FILENAME=toolchain_gnu_windows-x86_64_%%t.7z
41
+ set DL_LLVM_TOOLCHAIN_FILENAME=toolchain_llvm_windows-x86_64.7z
41
42
42
43
REM # Print banner
43
44
echo Zephyr SDK %VERSION% Setup
@@ -78,7 +79,10 @@ if /i [%1] equ [/t] (
78
79
goto end
79
80
)
80
81
)
82
+ set DO_GNU_TOOLCHAIN=y
81
83
shift
84
+ ) else if /i [%1] equ [/l] (
85
+ set DO_LLVM_TOOLCHAIN=y
82
86
) else if /i [%1] equ [/h] (
83
87
set DO_HOSTTOOLS=y
84
88
) else if /i [%1] equ [/c] (
@@ -104,27 +108,34 @@ echo.
104
108
REM # Check installation type
105
109
for %%t in (%GNU_TOOLCHAINS%) do (
106
110
if not exist gnu\%%t\ (
107
- set IS_PARTIAL_SDK =y
111
+ set IS_PARTIAL_GNU_SDK =y
108
112
)
109
113
)
110
114
111
115
REM # Ask user for set-up choices
112
- if [%IS_PARTIAL_SDK%] neq [] (
113
- choice /c:yn /m:"Install GNU toolchains for all targets"
114
- if [!ERRORLEVEL!] equ [1] (
115
- set INST_GNU_TOOLCHAINS=%GNU_TOOLCHAINS%
116
- ) else (
117
- for %%t in (%GNU_TOOLCHAINS%) do (
118
- if not exist gnu\%%t\ (
119
- choice /c:yn /m:"Install '%%t' GNU toolchain"
120
- if [!ERRORLEVEL!] equ [1] (
121
- set INST_GNU_TOOLCHAINS=!INST_GNU_TOOLCHAINS! %%t
116
+ choice /c:yn /m:"Install GNU toolchain"
117
+ if [!ERRORLEVEL!] equ [1] (
118
+ set DO_GNU_TOOLCHAIN=y
119
+ if [%IS_PARTIAL_GNU_SDK%] neq [] (
120
+ choice /c:yn /m:"Install GNU toolchains for all targets"
121
+ if [!ERRORLEVEL!] equ [1] (
122
+ set INST_GNU_TOOLCHAINS=%GNU_TOOLCHAINS%
123
+ ) else (
124
+ for %%t in (%GNU_TOOLCHAINS%) do (
125
+ if not exist gnu\%%t\ (
126
+ choice /c:yn /m:"Install '%%t' GNU toolchain"
127
+ if [!ERRORLEVEL!] equ [1] (
128
+ set INST_GNU_TOOLCHAINS=!INST_GNU_TOOLCHAINS! %%t
129
+ )
122
130
)
123
131
)
124
132
)
125
133
)
126
134
)
127
135
136
+ choice /c:yn /m:"Install LLVM toolchain"
137
+ if [%ERRORLEVEL%] equ [1] set DO_LLVM_TOOLCHAIN=y
138
+
128
139
choice /c:yn /m:"Install host tools"
129
140
if [%ERRORLEVEL%] equ [1] set DO_HOSTTOOLS=y
130
141
@@ -135,38 +146,72 @@ echo.
135
146
136
147
:process
137
148
REM # Install GNU toolchains
138
- if not exist gnu\ mkdir gnu
139
- pushd gnu
149
+ if [%DO_GNU_TOOLCHAIN%] neq [] (
150
+ if not exist gnu\ mkdir gnu
151
+ pushd gnu
152
+
153
+ for %%t in (%INST_GNU_TOOLCHAINS%) do (
154
+ set TOOLCHAIN_FILENAME=%DL_GNU_TOOLCHAIN_FILENAME%
155
+ set TOOLCHAIN_URI=%DL_REL_BASE%/!TOOLCHAIN_FILENAME!
156
+
157
+ if not exist %%t\ (
158
+ echo Installing '%%t' GNU toolchain ...
159
+
160
+ REM # Download toolchain archive
161
+ wget -q --show-progress -N -O !TOOLCHAIN_FILENAME! !TOOLCHAIN_URI!
162
+ if [!ERRORLEVEL!] neq [0] (
163
+ del /q !TOOLCHAIN_FILENAME!
164
+ echo ERROR: GNU toolchain download failed
165
+ set EXITCODE=20
166
+ goto end
167
+ )
168
+
169
+ REM # Extract archive
170
+ 7z x -o. !TOOLCHAIN_FILENAME!
171
+ if [!ERRORLEVEL!] neq [0] (
172
+ echo ERROR: GNU toolchain archive extraction failed
173
+ set EXITCODE=21
174
+ goto end
175
+ )
140
176
141
- for %%t in (%INST_GNU_TOOLCHAINS%) do (
142
- set TOOLCHAIN_FILENAME=%DL_GNU_TOOLCHAIN_FILENAME%
143
- set TOOLCHAIN_URI=%DL_REL_BASE%/!TOOLCHAIN_FILENAME!
177
+ REM # Remove archive
178
+ del /q !TOOLCHAIN_FILENAME!
179
+ )
180
+ )
181
+ popd
182
+ )
144
183
145
- if not exist %%t\ (
146
- echo Installing '%%t' GNU toolchain ...
184
+ REM # Install LLVM toolchain
185
+ if [%DO_LLVM_TOOLCHAIN%] neq [] (
186
+ if not exist llvm\ (
187
+ echo Installing LLVM toolchain ...
188
+
189
+ set TOOLCHAIN_FILENAME=%DL_GNU_TOOLCHAIN_FILENAME%
190
+ set TOOLCHAIN_URI=%DL_REL_BASE%/!TOOLCHAIN_FILENAME!
147
191
148
192
REM # Download toolchain archive
149
193
wget -q --show-progress -N -O !TOOLCHAIN_FILENAME! !TOOLCHAIN_URI!
150
194
if [!ERRORLEVEL!] neq [0] (
151
195
del /q !TOOLCHAIN_FILENAME!
152
- echo ERROR: GNU toolchain download failed
196
+ echo ERROR: LLVM toolchain download failed
153
197
set EXITCODE=20
154
198
goto end
155
199
)
156
200
157
201
REM # Extract archive
158
202
7z x -o. !TOOLCHAIN_FILENAME!
159
203
if [!ERRORLEVEL!] neq [0] (
160
- echo ERROR: GNU toolchain archive extraction failed
204
+ echo ERROR: LLVM toolchain archive extraction failed
161
205
set EXITCODE=21
162
206
goto end
163
207
)
164
208
165
209
REM # Remove archive
166
210
del /q !TOOLCHAIN_FILENAME!
211
+
212
+ echo.
167
213
)
168
214
)
169
- popd
170
215
171
216
REM # Install host tools
172
217
if [%DO_HOSTTOOLS%] neq [] (
@@ -195,6 +240,7 @@ echo %~n0 [/t ^<gnu_toolchain^>] [/h] [/c]
195
240
echo.
196
241
echo /t ^<gnu_toolchain^> Install specified GNU toolchain
197
242
echo all Install all GNU toolchains
243
+ echo /l Install LLVM toolchain
198
244
echo /h Install host tools
199
245
echo /c Register Zephyr SDK CMake package
200
246
echo.
0 commit comments