@@ -86,54 +86,62 @@ endfunction()
8686
8787set (CLANG_MFPU "none" )
8888set (CLANG_MFLOATABI "soft" )
89+ set (CLANG_MABI "" )
8990
9091if (CPU STREQUAL "Cortex-M0" )
9192 set (CLANG_ARCH "armv6m" )
9293 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
9394 set (CLANG_MCPU "cortex-m0" )
95+ set (CLANG_MFPU "" )
9496elseif (CPU STREQUAL "Cortex-M0+" )
9597 set (CLANG_ARCH "armv6m" )
9698 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
9799 set (CLANG_MCPU "cortex-m0plus" )
100+ set (CLANG_MFPU "" )
98101elseif (CPU STREQUAL "Cortex-M1" )
99102 set (CLANG_ARCH "armv6m" )
100103 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
101104 set (CLANG_MCPU "cortex-m1" )
105+ set (CLANG_MFPU "" )
102106elseif (CPU STREQUAL "Cortex-M3" )
103107 set (CLANG_ARCH "armv7m" )
104108 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
105109 set (CLANG_MCPU "cortex-m3" )
110+ set (CLANG_MFPU "" )
106111elseif (CPU STREQUAL "Cortex-M4" )
107112 set (CLANG_ARCH "armv7em" )
108113 if (FPU STREQUAL "SP_FPU" )
109114 set (CLANG_ARCH_SUFFIX "_hard_fpv4_sp_d16" )
110115 set (CLANG_MCPU "cortex-m4" )
111- set (CLANG_MFPU "fpv4-sp-d16 " )
116+ set (CLANG_MFPU "" )
112117 set (CLANG_MFLOATABI "hard" )
113118 else ()
114119 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
115- set (CLANG_MCPU "cortex-m4" )
120+ set (CLANG_MCPU "cortex-m4+nofp" )
121+ set (CLANG_MFPU "" )
116122 endif ()
117123elseif (CPU STREQUAL "Cortex-M7" )
118124 set (CLANG_ARCH "armv7em" )
119125 if (FPU STREQUAL "DP_FPU" )
120126 set (CLANG_ARCH_SUFFIX "_hard_fpv5_d16" )
121127 set (CLANG_MCPU "cortex-m7" )
122- set (CLANG_MFPU "fpv5-d16 " )
128+ set (CLANG_MFPU "" )
123129 set (CLANG_MFLOATABI "hard" )
124130 elseif (FPU STREQUAL "SP_FPU" )
125131 set (CLANG_ARCH_SUFFIX "_hard_fpv4_sp_d16" )
126- set (CLANG_MCPU "cortex-m7" )
127- set (CLANG_MFPU "fpv5-sp-d16 " )
132+ set (CLANG_MCPU "cortex-m7+nofp.dp " )
133+ set (CLANG_MFPU "" )
128134 set (CLANG_MFLOATABI "hard" )
129135 else ()
130136 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
131- set (CLANG_MCPU "cortex-m7" )
137+ set (CLANG_MCPU "cortex-m7+nofp" )
138+ set (CLANG_MFPU "" )
132139 endif ()
133140elseif (CPU STREQUAL "Cortex-M23" )
134- set (CLANG_ARCH "armv6m " )
141+ set (CLANG_ARCH "armv8m.base " )
135142 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
136143 set (CLANG_MCPU "cortex-m23" )
144+ set (CLANG_MFPU "" )
137145elseif (CPU STREQUAL "Cortex-M33" )
138146 set (CLANG_ARCH "armv8m.main" )
139147 if (FPU STREQUAL "SP_FPU" )
@@ -143,15 +151,16 @@ elseif(CPU STREQUAL "Cortex-M33")
143151 else ()
144152 set (CLANG_MCPU "cortex-m33+nodsp" )
145153 endif ()
146- set (CLANG_MFPU "fpv5-sp-d16 " )
154+ set (CLANG_MFPU "" )
147155 set (CLANG_MFLOATABI "hard" )
148156 else ()
149157 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
150158 if (DSP STREQUAL "DSP" )
151- set (CLANG_MCPU "cortex-m33" )
159+ set (CLANG_MCPU "cortex-m33+nofp " )
152160 else ()
153- set (CLANG_MCPU "cortex-m33+nodsp" )
161+ set (CLANG_MCPU "cortex-m33+nodsp+nofp " )
154162 endif ()
163+ set (CLANG_MFPU "" )
155164 endif ()
156165elseif (CPU STREQUAL "Cortex-M35P" )
157166 set (CLANG_ARCH "armv8m.main" )
@@ -162,38 +171,62 @@ elseif(CPU STREQUAL "Cortex-M35P")
162171 else ()
163172 set (CLANG_MCPU "cortex-m35p+nodsp" )
164173 endif ()
165- set (CLANG_MFPU "fpv5-sp-d16 " )
174+ set (CLANG_MFPU "" )
166175 set (CLANG_MFLOATABI "hard" )
167176 else ()
168177 set (CLANG_ARCH_SUFFIX "_soft_nofp" )
169178 if (DSP STREQUAL "DSP" )
170- set (CLANG_MCPU "cortex-m35p" )
179+ set (CLANG_MCPU "cortex-m35p+nofp " )
171180 else ()
172- set (CLANG_MCPU "cortex-m35p+nodsp" )
181+ set (CLANG_MCPU "cortex-m35p+nodsp+nofp " )
173182 endif ()
183+ set (CLANG_MFPU "" )
174184 endif ()
175185elseif (CPU STREQUAL "Cortex-M52" )
176186 set (CLANG_ARCH "armv8.1m.main" )
177187 if (FPU STREQUAL "NO_FPU" )
178188 if (MVE STREQUAL "NO_MVE" )
179189 set (CLANG_ARCH_SUFFIX "_soft_nofp_nomve" )
180- set (CLANG_MCPU "cortex-m52+nofp+nomve" )
181- else ()
190+ set (CLANG_MCPU "cortex-m52+nomve+nofp" )
191+ set (CLANG_MFPU "" )
192+ elseif (MVE STREQUAL "MVE" )
182193 set (CLANG_ARCH_SUFFIX "_hard_nofp_mve" )
183- set (CLANG_MCPU "cortex-m52+nofp" )
194+ set (CLANG_MCPU "cortex-m52+nomve.fp+nofp" )
195+ set (CLANG_MFPU "" )
184196 set (CLANG_MFLOATABI "hard" )
197+ elseif (MVE STREQUAL "FP_MVE" )
198+ message (FATAL_ERROR "Error: cortex-m52 MVE FP requires an FPU!" )
199+ else ()
200+ message (FATAL_ERROR "Error: cortex-m52 MVE option '${MVE} ' is not supported!" )
201+ endif ()
202+ elseif (FPU STREQUAL "SP_FPU" )
203+ set (CLANG_MFLOATABI "hard" )
204+ set (CLANG_MFPU "" )
205+ if (MVE STREQUAL "NO_MVE" )
206+ set (CLANG_ARCH_SUFFIX "_hard_fp_nomve" )
207+ set (CLANG_MCPU "cortex-m52+nomve+nofp.dp" )
208+ elseif (MVE STREQUAL "MVE" )
209+ set (CLANG_ARCH_SUFFIX "_hard_fp_nomve" )
210+ set (CLANG_MCPU "cortex-m52+nomve.fp+nofp.dp" )
211+ elseif (MVE STREQUAL "FP_MVE" )
212+ message (FATAL_ERROR "Error: cortex-m52 MVE FP requires DP_FPU!" )
213+ else ()
214+ message (FATAL_ERROR "Error: cortex-m52 MVE option '${MVE} ' is not supported!" )
185215 endif ()
186216 else ()
187- set (CLANG_ARCH_SUFFIX "_hard_fp" )
217+ set (CLANG_MFLOATABI "hard" )
218+ set (CLANG_MFPU "" )
188219 if (MVE STREQUAL "NO_MVE" )
220+ set (CLANG_ARCH_SUFFIX "_hard_fpdp_nomve" )
189221 set (CLANG_MCPU "cortex-m52+nomve" )
190222 elseif (MVE STREQUAL "MVE" )
191- set (CLANG_MCPU "cortex-m52+nomve.fp" )
192- else ()
223+ message (FATAL_ERROR "Error: cortex-m52 DP_FPU with integer-only MVE is not supported!" )
224+ elseif (MVE STREQUAL "FP_MVE" )
225+ set (CLANG_ARCH_SUFFIX "_hard_fpdp" )
193226 set (CLANG_MCPU "cortex-m52" )
227+ else ()
228+ message (FATAL_ERROR "Error: cortex-m52 MVE option '${MVE} ' is not supported!" )
194229 endif ()
195- set (CLANG_MFPU "fpv5-sp-d16" )
196- set (CLANG_MFLOATABI "hard" )
197230 endif ()
198231elseif (CPU STREQUAL "Star-MC3" )
199232 set (CLANG_ARCH "armv8.1m.main" )
@@ -235,153 +268,198 @@ elseif(CPU STREQUAL "Cortex-M55")
235268 if (FPU STREQUAL "NO_FPU" )
236269 if (MVE STREQUAL "NO_MVE" )
237270 set (CLANG_ARCH_SUFFIX "_soft_nofp_nomve" )
238- set (CLANG_MCPU "cortex-m55+nofp+nomve" )
239- else ()
271+ set (CLANG_MCPU "cortex-m55+nomve+nofp" )
272+ set (CLANG_MFPU "" )
273+ elseif (MVE STREQUAL "MVE" )
240274 set (CLANG_ARCH_SUFFIX "_hard_nofp_mve" )
241- set (CLANG_MCPU "cortex-m55+nofp" )
275+ set (CLANG_MCPU "cortex-m55+nomve.fp+nofp" )
276+ set (CLANG_MFPU "" )
242277 set (CLANG_MFLOATABI "hard" )
278+ elseif (MVE STREQUAL "FP_MVE" )
279+ message (FATAL_ERROR "Error: cortex-m55 MVE FP requires an FPU!" )
280+ else ()
281+ message (FATAL_ERROR "Error: cortex-m55 MVE option '${MVE} ' is not supported!" )
243282 endif ()
244283 else ()
245- set (CLANG_ARCH_SUFFIX "_hard_fp" )
284+ set (CLANG_MFPU "" )
285+ set (CLANG_MFLOATABI "hard" )
246286 if (MVE STREQUAL "NO_MVE" )
287+ set (CLANG_ARCH_SUFFIX "_hard_fpdp_nomve" )
247288 set (CLANG_MCPU "cortex-m55+nomve" )
248289 elseif (MVE STREQUAL "MVE" )
290+ set (CLANG_ARCH_SUFFIX "_hard_fpdp_nomve" )
249291 set (CLANG_MCPU "cortex-m55+nomve.fp" )
250- else ()
292+ elseif (MVE STREQUAL "FP_MVE" )
293+ set (CLANG_ARCH_SUFFIX "_hard_fpdp" )
251294 set (CLANG_MCPU "cortex-m55" )
295+ else ()
296+ message (FATAL_ERROR "Error: cortex-m55 MVE option '${MVE} ' is not supported!" )
252297 endif ()
253- set (CLANG_MFPU "fpv5-sp-d16" )
254- set (CLANG_MFLOATABI "hard" )
255298 endif ()
256299elseif (CPU STREQUAL "Cortex-M85" )
257300 set (CLANG_ARCH "armv8.1m.main" )
258301 if (FPU STREQUAL "NO_FPU" )
259302 if (MVE STREQUAL "NO_MVE" )
260303 set (CLANG_ARCH_SUFFIX "_soft_nofp_nomve" )
261- set (CLANG_MCPU "cortex-m85+nofp+nomve" )
262- else ()
304+ set (CLANG_MCPU "cortex-m85+nomve+nofp" )
305+ set (CLANG_MFPU "" )
306+ elseif (MVE STREQUAL "MVE" )
263307 set (CLANG_ARCH_SUFFIX "_hard_nofp_mve" )
264- set (CLANG_MCPU "cortex-m85+nofp" )
308+ set (CLANG_MCPU "cortex-m85+nomve.fp+nofp" )
309+ set (CLANG_MFPU "" )
265310 set (CLANG_MFLOATABI "hard" )
311+ elseif (MVE STREQUAL "FP_MVE" )
312+ message (FATAL_ERROR "Error: cortex-m85 MVE FP requires an FPU!" )
313+ else ()
314+ message (FATAL_ERROR "Error: cortex-m85 MVE option '${MVE} ' is not supported!" )
266315 endif ()
267316 else ()
268- set (CLANG_ARCH_SUFFIX "_hard_fp" )
317+ set (CLANG_MFPU "" )
318+ set (CLANG_MFLOATABI "hard" )
269319 if (MVE STREQUAL "NO_MVE" )
320+ set (CLANG_ARCH_SUFFIX "_hard_fpdp_nomve" )
270321 set (CLANG_MCPU "cortex-m85+nomve" )
271322 elseif (MVE STREQUAL "MVE" )
272- set (CLANG_MCPU "cortex-m85+nomve.fp" )
273- else ()
323+ message (FATAL_ERROR "Error: cortex-m85 with integer-only MVE and FPU is not supported!" )
324+ elseif (MVE STREQUAL "FP_MVE" )
325+ set (CLANG_ARCH_SUFFIX "_hard_fpdp" )
274326 set (CLANG_MCPU "cortex-m85" )
327+ else ()
328+ message (FATAL_ERROR "Error: cortex-m85 MVE option '${MVE} ' is not supported!" )
275329 endif ()
276- set (CLANG_MFPU "fpv5-sp-d16" )
277- set (CLANG_MFLOATABI "hard" )
278330 endif ()
279331elseif (CPU STREQUAL "Cortex-A5" )
280332 set (CLANG_ARCH "armv7" )
281333 if (FPU STREQUAL "DP_FPU" )
282- set (CLANG_MCPU "cortex-a5+nosimd " )
283- set (CLANG_MFPU "vfpv4-d16 " )
334+ set (CLANG_MCPU "cortex-a5" )
335+ set (CLANG_MFPU "" )
284336 set (CLANG_MFLOATABI "hard" )
285337 else ()
286- set (CLANG_MCPU "cortex-a5+nosimd+nofp" )
338+ set (CLANG_MCPU "cortex-a5+nofp" )
339+ set (CLANG_MFPU "" )
287340 endif ()
288341elseif (CPU STREQUAL "Cortex-A7" )
289342 set (CLANG_ARCH "armv7" )
290343 if (FPU STREQUAL "DP_FPU" )
291- set (CLANG_MCPU "cortex-a7+nosimd " )
292- set (CLANG_MFPU "vfpv4-d16 " )
344+ set (CLANG_MCPU "cortex-a7" )
345+ set (CLANG_MFPU "" )
293346 set (CLANG_MFLOATABI "hard" )
294347 else ()
295- set (CLANG_MCPU "cortex-a7+nosimd+nofp" )
348+ set (CLANG_MCPU "cortex-a7+nofp" )
349+ set (CLANG_MFPU "" )
296350 endif ()
297351elseif (CPU STREQUAL "Cortex-A9" )
298352 set (CLANG_ARCH "armv7" )
299353 if (FPU STREQUAL "DP_FPU" )
300- set (CLANG_MCPU "cortex-a9+nosimd " )
301- set (CLANG_MFPU "vfpv3-d16 " )
354+ set (CLANG_MCPU "cortex-a9" )
355+ set (CLANG_MFPU "" )
302356 set (CLANG_MFLOATABI "hard" )
303357 else ()
304- set (CLANG_MCPU "cortex-a9+nosimd+nofp" )
358+ set (CLANG_MCPU "cortex-a9+nofp" )
359+ set (CLANG_MFPU "" )
305360 endif ()
306361elseif (CPU STREQUAL "Cortex-A35" )
307362 set (CLANG_ARCH "armv8" )
308363 if (FPU STREQUAL "DP_FPU" )
309364 set (CLANG_MCPU "cortex-a35" )
365+ set (CLANG_MABI "aapcs" )
310366 else ()
311367 set (CLANG_MCPU "cortex-a35+nofp" )
368+ set (CLANG_MABI "aapcs-soft" )
312369 endif ()
313370elseif (CPU STREQUAL "Cortex-A53" )
314371 set (CLANG_ARCH "armv8" )
315372 if (FPU STREQUAL "DP_FPU" )
316373 set (CLANG_MCPU "cortex-a53" )
374+ set (CLANG_MABI "aapcs" )
317375 else ()
318376 set (CLANG_MCPU "cortex-a53+nofp" )
377+ set (CLANG_MABI "aapcs-soft" )
319378 endif ()
320379elseif (CPU STREQUAL "Cortex-A55" )
321380 set (CLANG_ARCH "armv8" )
322381 if (FPU STREQUAL "DP_FPU" )
323382 set (CLANG_MCPU "cortex-a55" )
383+ set (CLANG_MABI "aapcs" )
324384 else ()
325385 set (CLANG_MCPU "cortex-a55+nofp" )
386+ set (CLANG_MABI "aapcs-soft" )
326387 endif ()
327388elseif (CPU STREQUAL "Cortex-A57" )
328389 set (CLANG_ARCH "armv8" )
329390 if (FPU STREQUAL "DP_FPU" )
330391 set (CLANG_MCPU "cortex-a57" )
392+ set (CLANG_MABI "aapcs" )
331393 else ()
332394 set (CLANG_MCPU "cortex-a57+nofp" )
395+ set (CLANG_MABI "aapcs-soft" )
333396 endif ()
334397elseif (CPU STREQUAL "Cortex-R4" )
335398 set (CLANG_ARCH "armv7" )
336399 if (FPU STREQUAL "DP_FPU" )
337400 set (CLANG_MCPU "cortex-r4f" )
338- set (CLANG_MFPU "vfpv3-d16 " )
401+ set (CLANG_MFPU "" )
339402 set (CLANG_MFLOATABI "hard" )
340403 else ()
341- set (CLANG_MCPU "cortex-r4+nofp" )
404+ set (CLANG_MCPU "cortex-r4" )
405+ set (CLANG_MFPU "" )
342406 endif ()
343407elseif (CPU STREQUAL "Cortex-R5" )
344408 set (CLANG_ARCH "armv7" )
345409 if (FPU STREQUAL "DP_FPU" )
346410 set (CLANG_MCPU "cortex-r5" )
347- set (CLANG_MFPU "vfpv3-d16 " )
411+ set (CLANG_MFPU "" )
348412 set (CLANG_MFLOATABI "hard" )
349413 else ()
350414 set (CLANG_MCPU "cortex-r5+nofp" )
415+ set (CLANG_MFPU "" )
351416 endif ()
352417elseif (CPU STREQUAL "Cortex-R7" )
353418 set (CLANG_ARCH "armv7" )
354419 if (FPU STREQUAL "DP_FPU" )
355420 set (CLANG_MCPU "cortex-r7" )
356- set (CLANG_MFPU "vfpv3-d16 " )
421+ set (CLANG_MFPU "" )
357422 set (CLANG_MFLOATABI "hard" )
358423 else ()
359- set (CLANG_MCPU "-mcpu=cortex-r7+nofp" )
424+ set (CLANG_MCPU "cortex-r7+nofp" )
425+ set (CLANG_MFPU "" )
360426 endif ()
361427elseif (CPU STREQUAL "Cortex-R8" )
362428 set (CLANG_ARCH "armv7" )
363429 if (FPU STREQUAL "DP_FPU" )
364430 set (CLANG_MCPU "cortex-r8" )
365- set (CLANG_MFPU "vfpv3-d16 " )
431+ set (CLANG_MFPU "" )
366432 set (CLANG_MFLOATABI "hard" )
367433 else ()
368- set (CLANG_MCPU "-mcpu=cortex-r8+nofp" )
434+ set (CLANG_MCPU "cortex-r8+nofp" )
435+ set (CLANG_MFPU "" )
369436 endif ()
370437endif ()
371438if (NOT DEFINED CLANG_MCPU)
372439 message (FATAL_ERROR "Error: CPU is not supported!" )
373440endif ()
374441
442+ set (CLANG_ABI "" )
443+ if (NOT "${CLANG_MABI} " STREQUAL "" )
444+ set (CLANG_ABI "-mabi=${CLANG_MABI} " )
445+ endif ()
446+
375447if (CLANG_ARCH STREQUAL "armv8" )
376448 set (CLANG_TARGET "aarch64-none-elf" )
377- set (CLANG_CPU "-mcpu=${CLANG_MCPU} " )
449+ set (CLANG_CPU "--target= ${CLANG_TARGET} - mcpu=${CLANG_MCPU} ${CLANG_ABI } " )
378450else ()
379- if (CLANG_MFLOATABI STREQUAL "hard" )
451+ if (CPU MATCHES "^Cortex-[AMR]" )
452+ set (CLANG_TARGET "arm-none-eabi" )
453+ elseif (CLANG_MFLOATABI STREQUAL "hard" )
380454 set (CLANG_TARGET "${CLANG_ARCH} -none-eabihf" )
381455 else ()
382456 set (CLANG_TARGET "${CLANG_ARCH} -none-eabi" )
383457 endif ()
384- set (CLANG_CPU "--target=${CLANG_TARGET} -mcpu=${CLANG_MCPU} -mfpu=${CLANG_MFPU} -mfloat-abi=${CLANG_MFLOATABI} " )
458+ if ("${CLANG_MFPU} " STREQUAL "" )
459+ set (CLANG_CPU "--target=${CLANG_TARGET} -mcpu=${CLANG_MCPU} -mfloat-abi=${CLANG_MFLOATABI} " )
460+ else ()
461+ set (CLANG_CPU "--target=${CLANG_TARGET} -mcpu=${CLANG_MCPU} -mfpu=${CLANG_MFPU} -mfloat-abi=${CLANG_MFLOATABI} " )
462+ endif ()
385463endif ()
386464
387465set (CMAKE_CXX_COMPILER_TARGET "${CLANG_TARGET} " )
0 commit comments