16 'features': ['thumbv6m'],
17 'header': 'core_cm0.h',
19 '__CM0_REV': '0x0000U',
20 '__NVIC_PRIO_BITS': '2U',
21 '__Vendor_SysTickConfig': '0U'
28 'mcpu': 'cortex-m0plus',
31 'features': ['thumbv6m'],
32 'header': 'core_cm0plus.h',
34 '__CM0PLUS_REV': '0x0000U',
35 '__MPU_PRESENT': '1U',
36 '__VTOR_PRESENT': '1U',
37 '__NVIC_PRIO_BITS': '2U',
38 '__Vendor_SysTickConfig': '0U'
43 'triple': 'thumbv7-m',
48 'features': ['thumbv6m', 'thumbv7m', 'thumb-2', 'sat', 'ldrex', 'clz'],
49 'header': 'core_cm3.h',
51 '__CM3_REV': '0x0000U',
52 '__MPU_PRESENT': '1U',
53 '__VTOR_PRESENT': '1U',
54 '__NVIC_PRIO_BITS': '3U',
55 '__Vendor_SysTickConfig': '0U'
60 'triple': 'thumbv7-em',
65 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
66 'header': 'core_cm4.h',
68 '__CM4_REV': '0x0000U',
69 '__FPU_PRESENT': '0U',
70 '__MPU_PRESENT': '1U',
71 '__VTOR_PRESENT': '1U',
72 '__NVIC_PRIO_BITS': '3U',
73 '__Vendor_SysTickConfig': '0U'
78 'triple': 'thumbv7-em',
81 'mfpu': 'fpv4-sp-d16',
83 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
84 'header': 'core_cm4.h',
86 '__CM4_REV': '0x0000U',
87 '__FPU_PRESENT': '1U',
88 '__MPU_PRESENT': '1U',
89 '__VTOR_PRESENT': '1U',
90 '__NVIC_PRIO_BITS': '3U',
91 '__Vendor_SysTickConfig': '0U'
96 'triple': 'thumbv7-em',
101 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
102 'header': 'core_cm7.h',
104 '__CM7_REV': '0x0000U',
105 '__FPU_PRESENT': '0U',
106 '__MPU_PRESENT': '1U',
107 '__ICACHE_PRESENT': '1U',
108 '__DCACHE_PRESENT': '1U',
109 '__DTCM_PRESENT': '1U',
110 '__VTOR_PRESENT': '1U',
111 '__NVIC_PRIO_BITS': '3U',
112 '__Vendor_SysTickConfig': '0U'
117 'triple': 'thumbv7-em',
120 'mfpu': 'fpv5-sp-d16',
122 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
123 'header': 'core_cm7.h',
125 '__CM7_REV': '0x0000U',
126 '__FPU_PRESENT': '1U',
127 '__MPU_PRESENT': '1U',
128 '__ICACHE_PRESENT': '1U',
129 '__DCACHE_PRESENT': '1U',
130 '__DTCM_PRESENT': '1U',
131 '__VTOR_PRESENT': '1U',
132 '__NVIC_PRIO_BITS': '3U',
133 '__Vendor_SysTickConfig': '0U'
138 'triple': 'thumbv7-em',
143 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
144 'header': 'core_cm7.h',
146 '__CM7_REV': '0x0000U',
147 '__FPU_PRESENT': '1U',
148 '__MPU_PRESENT': '1U',
149 '__ICACHE_PRESENT': '1U',
150 '__DCACHE_PRESENT': '1U',
151 '__DTCM_PRESENT': '1U',
152 '__VTOR_PRESENT': '1U',
153 '__NVIC_PRIO_BITS': '3U',
154 '__Vendor_SysTickConfig': '0U'
158 'arch': 'thumbv8m.base',
159 'triple': 'thumbv8m',
161 'mcpu': 'cortex-m23',
164 'features': ['thumbv6m', 'thumbv7m', 'thumbv8m.base', 'ldrex'],
165 'header': 'core_cm23.h',
167 '__CM23_REV': '0x0000U',
168 '__FPU_PRESENT': '0U',
169 '__MPU_PRESENT': '1U',
170 '__SAUREGION_PRESENT': '8U',
171 '__VTOR_PRESENT': '1U',
172 '__NVIC_PRIO_BITS': '3U',
173 '__Vendor_SysTickConfig': '0U'
177 'arch': 'thumbv8m.base',
178 'triple': 'thumbv8m',
180 'mcpu': 'cortex-m23',
183 'features': ['thumbv6m', 'thumbv7m', 'thumbv8m.base', 'ldrex'],
184 'header': 'core_cm23.h',
186 '__CM23_REV': '0x0000U',
187 '__FPU_PRESENT': '0U',
188 '__MPU_PRESENT': '1U',
189 '__SAUREGION_PRESENT': '8U',
190 '__VTOR_PRESENT': '1U',
191 '__NVIC_PRIO_BITS': '3U',
192 '__Vendor_SysTickConfig': '0U'
196 'arch': 'thumbv8m.base',
197 'triple': 'thumbv8m',
199 'mcpu': 'cortex-m23',
202 'features': ['thumbv6m', 'thumbv7m', 'thumbv8m.base', 'ldrex'],
203 'header': 'core_cm23.h',
205 '__CM23_REV': '0x0000U',
206 '__FPU_PRESENT': '0U',
207 '__MPU_PRESENT': '1U',
208 '__SAUREGION_PRESENT': '8U',
209 '__VTOR_PRESENT': '1U',
210 '__NVIC_PRIO_BITS': '3U',
211 '__Vendor_SysTickConfig': '0U'
215 'arch': 'thumbv8m.main',
216 'triple': 'thumbv8m',
218 'mcpu': 'cortex-m33',
221 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
222 'header': 'core_cm33.h',
224 '__CM33_REV': '0x0000U',
225 '__FPU_PRESENT': '1U',
226 '__MPU_PRESENT': '1U',
227 '__SAUREGION_PRESENT': '8U',
228 '__VTOR_PRESENT': '1U',
229 '__NVIC_PRIO_BITS': '3U',
230 '__Vendor_SysTickConfig': '0U'
234 'arch': 'thumbv8m.main',
235 'triple': 'thumbv8m',
237 'mcpu': 'cortex-m33',
240 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
241 'header': 'core_cm33.h',
243 '__CM33_REV': '0x0000U',
244 '__FPU_PRESENT': '1U',
245 '__MPU_PRESENT': '1U',
246 '__SAUREGION_PRESENT': '8U',
247 '__VTOR_PRESENT': '1U',
248 '__NVIC_PRIO_BITS': '3U',
249 '__Vendor_SysTickConfig': '0U'
253 'arch': 'thumbv8m.main',
254 'triple': 'thumbv8m',
256 'mcpu': 'cortex-m33',
259 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
260 'header': 'core_cm33.h',
262 '__CM33_REV': '0x0000U',
263 '__FPU_PRESENT': '1U',
264 '__MPU_PRESENT': '1U',
265 '__SAUREGION_PRESENT': '8U',
266 '__VTOR_PRESENT': '1U',
267 '__NVIC_PRIO_BITS': '3U',
268 '__Vendor_SysTickConfig': '0U'
272 'arch': 'thumbv8m.main',
273 'triple': 'thumbv8m',
275 'mcpu': 'cortex-m35p',
278 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
279 'header': 'core_cm35p.h',
281 '__CM35P_REV': '0x0000U',
282 '__FPU_PRESENT': '1U',
283 '__MPU_PRESENT': '1U',
284 '__SAUREGION_PRESENT': '8U',
285 '__VTOR_PRESENT': '1U',
286 '__NVIC_PRIO_BITS': '3U',
287 '__Vendor_SysTickConfig': '0U'
291 'arch': 'thumbv8m.main',
292 'triple': 'thumbv8m',
294 'mcpu': 'cortex-m35p',
297 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
298 'header': 'core_cm35p.h',
300 '__CM35P_REV': '0x0000U',
301 '__FPU_PRESENT': '1U',
302 '__MPU_PRESENT': '1U',
303 '__SAUREGION_PRESENT': '8U',
304 '__VTOR_PRESENT': '1U',
305 '__NVIC_PRIO_BITS': '3U',
306 '__Vendor_SysTickConfig': '0U'
310 'arch': 'thumbv8m.main',
311 'triple': 'thumbv8m',
313 'mcpu': 'cortex-m35p',
316 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
317 'header': 'core_cm35p.h',
319 '__CM35P_REV': '0x0000U',
320 '__FPU_PRESENT': '1U',
321 '__MPU_PRESENT': '1U',
322 '__SAUREGION_PRESENT': '8U',
323 '__VTOR_PRESENT': '1U',
324 '__NVIC_PRIO_BITS': '3U',
325 '__Vendor_SysTickConfig': '0U'
329 'arch': 'thumbv8.1m.main',
330 'triple': 'thumbv8m',
332 'mcpu': 'cortex-m55',
335 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
336 'header': 'core_cm55.h',
338 '__CM55_REV': '0x0000U',
339 '__FPU_PRESENT': '1U',
341 '__MPU_PRESENT': '1U',
342 '__ICACHE_PRESENT': '1U',
343 '__DCACHE_PRESENT': '1U',
344 '__SAUREGION_PRESENT': '8U',
345 '__DSP_PRESENT': '1U',
346 '__VTOR_PRESENT': '1U',
347 '__PMU_PRESENT': '1U',
348 '__PMU_NUM_EVENTCNT': '8U',
349 '__DSP_PRESENT': '1U',
350 '__NVIC_PRIO_BITS': '3U',
351 '__Vendor_SysTickConfig': '0U'
355 'arch': 'thumbv8.1m.main',
356 'triple': 'thumbv8m',
358 'mcpu': 'cortex-m55',
361 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
362 'header': 'core_cm55.h',
364 '__CM55_REV': '0x0000U',
365 '__FPU_PRESENT': '1U',
367 '__MPU_PRESENT': '1U',
368 '__ICACHE_PRESENT': '1U',
369 '__DCACHE_PRESENT': '1U',
370 '__SAUREGION_PRESENT': '8U',
371 '__DSP_PRESENT': '1U',
372 '__VTOR_PRESENT': '1U',
373 '__PMU_PRESENT': '1U',
374 '__PMU_NUM_EVENTCNT': '8U',
375 '__DSP_PRESENT': '1U',
376 '__NVIC_PRIO_BITS': '3U',
377 '__Vendor_SysTickConfig': '0U'
381 'arch': 'thumbv8.1m.main',
382 'triple': 'thumbv8m',
384 'mcpu': 'cortex-m55',
387 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
388 'header': 'core_cm55.h',
390 '__CM55_REV': '0x0000U',
391 '__FPU_PRESENT': '1U',
393 '__MPU_PRESENT': '1U',
394 '__ICACHE_PRESENT': '1U',
395 '__DCACHE_PRESENT': '1U',
396 '__SAUREGION_PRESENT': '8U',
397 '__DSP_PRESENT': '1U',
398 '__VTOR_PRESENT': '1U',
399 '__PMU_PRESENT': '1U',
400 '__PMU_NUM_EVENTCNT': '8U',
401 '__DSP_PRESENT': '1U',
402 '__NVIC_PRIO_BITS': '3U',
403 '__Vendor_SysTickConfig': '0U'
407 'arch': 'thumbv8.1m.main',
408 'triple': 'thumbv8m',
410 'mcpu': 'cortex-m85',
413 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
414 'header': 'core_cm85.h',
416 '__CM85_REV': '0x0000U',
417 '__FPU_PRESENT': '1U',
419 '__MPU_PRESENT': '1U',
420 '__ICACHE_PRESENT': '1U',
421 '__DCACHE_PRESENT': '1U',
422 '__SAUREGION_PRESENT': '8U',
423 '__DSP_PRESENT': '1U',
424 '__VTOR_PRESENT': '1U',
425 '__PMU_PRESENT': '1U',
426 '__PMU_NUM_EVENTCNT': '8U',
427 '__DSP_PRESENT': '1U',
428 '__NVIC_PRIO_BITS': '3U',
429 '__Vendor_SysTickConfig': '0U'
433 'arch': 'thumbv8.1m.main',
434 'triple': 'thumbv8m',
436 'mcpu': 'cortex-m85',
439 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
440 'header': 'core_cm85.h',
442 '__CM85_REV': '0x0000U',
443 '__FPU_PRESENT': '1U',
445 '__MPU_PRESENT': '1U',
446 '__ICACHE_PRESENT': '1U',
447 '__DCACHE_PRESENT': '1U',
448 '__SAUREGION_PRESENT': '8U',
449 '__DSP_PRESENT': '1U',
450 '__VTOR_PRESENT': '1U',
451 '__PMU_PRESENT': '1U',
452 '__PMU_NUM_EVENTCNT': '8U',
453 '__DSP_PRESENT': '1U',
454 '__NVIC_PRIO_BITS': '3U',
455 '__Vendor_SysTickConfig': '0U'
459 'arch': 'thumbv8.1m.main',
460 'triple': 'thumbv8m',
462 'mcpu': 'cortex-m85',
465 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
466 'header': 'core_cm85.h',
468 '__CM85_REV': '0x0000U',
469 '__FPU_PRESENT': '1U',
471 '__MPU_PRESENT': '1U',
472 '__ICACHE_PRESENT': '1U',
473 '__DCACHE_PRESENT': '1U',
474 '__SAUREGION_PRESENT': '8U',
475 '__DSP_PRESENT': '1U',
476 '__VTOR_PRESENT': '1U',
477 '__PMU_PRESENT': '1U',
478 '__PMU_NUM_EVENTCNT': '8U',
479 '__DSP_PRESENT': '1U',
480 '__NVIC_PRIO_BITS': '3U',
481 '__Vendor_SysTickConfig': '0U'
491 'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
492 'header': 'core_ca.h',
495 '__CA_REV': '0x0000U',
496 '__FPU_PRESENT': '0U',
497 '__GIC_PRESENT': '1U',
498 '__TIM_PRESENT': '1U',
499 '__L2C_PRESENT': '1U',
500 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
501 'GIC_INTERFACE_BASE': '0x2C000100UL',
502 'TIMER_BASE': '0x2C000600UL',
503 'L2C_310_BASE': '0x2C0F0000UL',
512 'mfpu': 'neon-vfpv4',
514 'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'clz'],
515 'header': 'core_ca.h',
518 '__CA_REV': '0x0000U',
519 '__FPU_PRESENT': '1U',
520 '__GIC_PRESENT': '1U',
521 '__TIM_PRESENT': '1U',
522 '__L2C_PRESENT': '1U',
523 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
524 'GIC_INTERFACE_BASE': '0x2C000100UL',
525 'TIMER_BASE': '0x2C000600UL',
526 'L2C_310_BASE': '0x2C0F0000UL',
537 'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
538 'header': 'core_ca.h',
541 '__CA_REV': '0x0000U',
542 '__FPU_PRESENT': '0U',
543 '__GIC_PRESENT': '1U',
544 '__TIM_PRESENT': '1U',
545 '__L2C_PRESENT': '1U',
546 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
547 'GIC_INTERFACE_BASE': '0x2C000100UL',
548 'TIMER_BASE': '0x2C000600UL',
549 'L2C_310_BASE': '0x2C0F0000UL',
558 'mfpu': 'neon-vfpv4',
560 'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'clz'],
561 'header': 'core_ca.h',
564 '__CA_REV': '0x0000U',
565 '__FPU_PRESENT': '1U',
566 '__GIC_PRESENT': '1U',
567 '__TIM_PRESENT': '1U',
568 '__L2C_PRESENT': '1U',
569 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
570 'GIC_INTERFACE_BASE': '0x2C000100UL',
571 'TIMER_BASE': '0x2C000600UL',
572 'L2C_310_BASE': '0x2C0F0000UL',
583 'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
584 'header': 'core_ca.h',
587 '__CA_REV': '0x0000U',
588 '__FPU_PRESENT': '0U',
589 '__GIC_PRESENT': '1U',
590 '__TIM_PRESENT': '1U',
591 '__L2C_PRESENT': '1U',
592 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
593 'GIC_INTERFACE_BASE': '0x2C000100UL',
594 'TIMER_BASE': '0x2C000600UL',
595 'L2C_310_BASE': '0x2C0F0000UL',
604 'mfpu': 'neon-vfpv3',
606 'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'ldrex', 'clz'],
607 'header': 'core_ca.h',
610 '__CA_REV': '0x0000U',
611 '__FPU_PRESENT': '1U',
612 '__GIC_PRESENT': '1U',
613 '__TIM_PRESENT': '1U',
614 '__L2C_PRESENT': '1U',
615 'GIC_DISTRIBUTOR_BASE': '0x2C001000UL',
616 'GIC_INTERFACE_BASE': '0x2C000100UL',
617 'TIMER_BASE': '0x2C000600UL',
618 'L2C_310_BASE': '0x2C0F0000UL',
624 # Configuration file for the 'lit' test runner.
626 # name: The name of this test suite.
627 config.name = "CMSIS-Core"
629 # testFormat: The test format to use to interpret tests.
631 # For now we require '&&' between commands, until they get globally killed and
632 # the test runner updated.
633 config.test_format = lit.formats.ShTest()
635 # suffixes: A list of file extensions to treat as test files.
640 # test_source_root: The root path where tests are located.
641 config.test_source_root = os.path.dirname(__file__)
644 preserv_env_vars = ['IAR_LMS_SETTINGS_DIR']
645 for var in preserv_env_vars:
646 if var in os.environ:
647 config.environment[var] = os.environ[var]
649 # clang_path = get_toolchain_from_env('CLANG')
651 toolchain = lit_config.params.get("toolchain", "AC6")
652 device = lit_config.params.get("device", "ARMCM3")
653 optimize = lit_config.params.get("optimize", "none")
656 def __init__(self, toolchain, device, optimize):
657 self._toolchain = toolchain
659 self.optimize = optimize
661 def get_root_from_env(self):
662 keys = sorted((k for k in os.environ.keys() if k.startswith(f'{self._toolchain}_TOOLCHAIN_')), reverse=True)
664 print(f"Toolchain '{self._toolchain}' not registered!")
666 return os.environ.get(keys[0])
669 return self.get_root_from_env()
672 class Toolchain_AC6(Toolchain):
680 def __init__(self, **args):
681 super().__init__('AC6', **args)
684 return os.path.join(self.get_root(), 'armclang')
686 def get_ccflags(self):
688 '--target=arm-arm-none-eabi', f'-mcpu={DEVICES[self.device]["mcpu"]}', f'-mfpu={DEVICES[self.device]["mfpu"]}',
689 self.OPTIMIZE[self.optimize], '-I', os.path.abspath('../Include'), '-c', '-D', f'CORE_HEADER=\\"{DEVICES[device]["header"]}\\"']
690 if device.endswith('S') and not device.endswith('NS'):
691 ccflags += ["-mcmse"]
692 ccflags += list(sum([('-D', f'{define}={value}') for (define, value) in DEVICES[self.device]['defines'].items()], ()))
696 class Toolchain_GCC(Toolchain):
704 def __init__(self, **args):
705 super().__init__('GCC', **args)
708 return os.path.join(self.get_root(), 'arm-none-eabi-gcc')
710 def get_ccflags(self):
712 if DEVICES[self.device]["mfpu"] != 'none':
715 f'-mcpu={DEVICES[self.device]["mcpu"]}', f'-mfloat-abi={floatabi}',
716 self.OPTIMIZE[self.optimize], '-I', os.path.abspath('../Include'),
717 '-D', f'CORE_HEADER=\\"{DEVICES[device]["header"]}\\"', '-c']
718 if DEVICES[self.device]["mfpu"] != "none":
719 ccflags += [f'-mfpu={DEVICES[self.device]["mfpu"]}']
720 if device.endswith('S') and not device.endswith('NS'):
721 ccflags += ["-mcmse"]
722 ccflags += list(sum([('-D', f'{define}={value}') for (define, value) in DEVICES[self.device]['defines'].items()], ()))
726 class Toolchain_Clang(Toolchain):
728 'CM0': 'thumbv6m-none-unknown-eabi',
729 'CM0plus': 'thumbv6m-none-unknown-eabi',
730 'CM3': 'thumbv7m-none-unknown-eabi',
731 'CM4': 'thumbv7em-none-unknown-eabi',
732 'CM4FP': 'thumbv7em-none-unknown-eabihf',
733 'CM7': 'thumbv7em-none-unknown-eabi',
734 'CM7SP': 'thumbv7em-none-unknown-eabihf',
735 'CM7DP': 'thumbv7em-none-unknown-eabihf',
736 'CM23': 'thumbv8m.base-none-unknown-eabi',
737 'CM23S': 'thumbv8m.base-none-unknown-eabi',
738 'CM23NS': 'thumbv8m.base-none-unknown-eabi',
739 'CM33': 'thumbv8m.main-none-unknown-eabihf',
740 'CM33S': 'thumbv8m.main-none-unknown-eabihf',
741 'CM33NS': 'thumbv8m.main-none-unknown-eabihf',
742 'CM35P': 'thumbv8m.main-none-unknown-eabihf',
743 'CM35PS': 'thumbv8m.main-none-unknown-eabihf',
744 'CM35PNS': 'thumbv8m.main-none-unknown-eabihf',
745 'CM55': 'thumbv8.1m.main-none-unknown-eabihf',
746 'CM55S': 'thumbv8.1m.main-none-unknown-eabihf',
747 'CM55NS': 'thumbv8.1m.main-none-unknown-eabihf',
748 'CM85': 'thumbv8.1m.main-none-unknown-eabihf',
749 'CM85S': 'thumbv8.1m.main-none-unknown-eabihf',
750 'CM85NS': 'thumbv8.1m.main-none-unknown-eabihf',
751 'CA5': 'armv7-none-unknown-eabi',
752 'CA5neon': 'armv7-none-unknown-eabihf',
753 'CA7': 'armv7-none-unknown-eabi',
754 'CA7neon': 'armv7-none-unknown-eabihf',
755 'CA9': 'armv7-none-unknown-eabi',
756 'CA9neon': 'armv7-none-unknown-eabihf'
764 def __init__(self, **args):
765 super().__init__('CLANG', **args)
768 return os.path.join(self.get_root(), 'clang')
770 def get_ccflags(self):
772 f'--target={self.TARGET[self.device]}', self.OPTIMIZE[self.optimize],
773 f'-mcpu={DEVICES[self.device]["mcpu"]}', f'-mfpu={DEVICES[self.device]["mfpu"]}',
774 '-I', os.path.abspath('../Include'), '-c', '-D', f'CORE_HEADER=\\"{DEVICES[device]["header"]}\\"']
775 if device.endswith('S') and not device.endswith('NS'):
776 ccflags += ["-mcmse"]
777 ccflags += list(sum([('-D', f'{define}={value}') for (define, value) in DEVICES[self.device]['defines'].items()], ()))
782 class Toolchain_IAR(Toolchain):
792 'CM0plus': 'cortex-m0+',
795 'CM4FP': 'cortex-m4.fp.sp',
797 'CM7SP': 'cortex-m7.fp.sp',
798 'CM7DP': 'cortex-m7.fp.dp',
799 'CM23': 'cortex-m.no_se',
801 'CM23NS': 'cortex-m',
802 'CM33': 'cortex-m.no_se',
804 'CM33NS': 'cortex-m',
805 'CM35P': 'cortex-m.no_se',
806 'CM35PS': 'cortex-m',
807 'CM35PNS': 'cortex-m',
808 'CM55': 'cortex-m.no_se',
810 'CM55NS': 'cortex-m',
811 'CM85': 'cortex-m.no_se',
813 'CM85NS': 'cortex-m',
815 'CA5neon': 'cortex-a5.neon',
816 'CA7': 'cortex-a7.no_neon.no_vfp',
817 'CA7neon': 'cortex-a7',
818 'CA9': 'cortex-a9.no_neon.no_vfp',
819 'CA9neon': 'cortex-a9'
824 'fpv3-d16': 'vfpv3_d16',
825 'fpv4-sp-d16': 'vfpv4-sp',
826 'fpv5-sp-d16': 'vfpv5-sp',
827 'fpv5-d16': 'vfpv5_d16',
828 'neon-vfpv3': 'vfpv3',
829 'neon-vfpv4': 'vfpv4'
832 def __init__(self, **args):
833 super().__init__('IAR', **args)
836 return os.path.join(self.get_root(), 'iccarm')
838 def get_ccflags(self):
840 '-e', f'--cpu={self.CPU[self.device]}', f'--fpu={self.FPU[DEVICES[self.device]["mfpu"]]}',
841 self.OPTIMIZE[self.optimize], '-I', '../Include', '-c', '-D', f'CORE_HEADER=\\"{DEVICES[device]["header"]}\\"']
842 if device.endswith('S') and not device.endswith('NS'):
843 ccflags += ["--cmse"]
844 ccflags += list(sum([('-D', f'{define}={value}') for (define, value) in DEVICES[self.device]['defines'].items()], ()))
849 if toolchain == 'AC6':
850 tc = Toolchain_AC6(device=device, optimize=optimize)
851 elif toolchain == 'GCC':
852 tc = Toolchain_GCC(device=device, optimize=optimize)
853 elif toolchain == 'Clang':
854 tc = Toolchain_Clang(device=device, optimize=optimize)
855 elif toolchain == 'IAR':
856 tc = Toolchain_IAR(device=device, optimize=optimize)
859 if device.endswith('NS'):
860 prefixes += ['CHECK-NS']
861 elif device.endswith('S'):
862 prefixes += ['CHECK-S']
863 if DEVICES[device]['arch'].startswith('thumb'):
864 prefixes += ['CHECK-THUMB']
865 elif DEVICES[device]['arch'].startswith('arm'):
866 prefixes += ['CHECK-ARM']
868 if DEVICES[device]["mfpu"] != 'none':
869 config.available_features.add('fpu')
870 for feature in DEVICES[device]['features']:
871 config.available_features.add(feature)
873 objdump = os.path.join(Toolchain("CLANG", "none", "none").get_root(), 'llvm-objdump')
874 config.substitutions.append(("llvm-objdump", objdump))
876 config.substitutions.append(("%ccout%", "-o"))
877 config.substitutions.append(("%cc%", tc.get_cc()))
878 config.substitutions.append(("%ccflags%", ' '.join(tc.get_ccflags())))
879 config.substitutions.append(("%prefixes%", ','.join(prefixes)))
880 config.substitutions.append(("%triple%", DEVICES[device]['triple']))
881 config.substitutions.append(("%mcpu%", DEVICES[device]['mcpu']))