|
117 | 117 | 'triple': 'thumbv7-em', |
118 | 118 | 'abi': 'eabi', |
119 | 119 | 'mcpu': 'cortex-m7', |
120 | | - 'mfpu': 'fpv4-sp-d16', |
| 120 | + 'mfpu': 'fpv5-sp-d16', |
121 | 121 | 'mpu': True, |
122 | 122 | 'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'], |
123 | 123 | 'header': 'core_cm7.h', |
|
640 | 640 | # test_source_root: The root path where tests are located. |
641 | 641 | config.test_source_root = os.path.dirname(__file__) |
642 | 642 |
|
| 643 | +# environment |
| 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] |
643 | 648 |
|
644 | 649 | # clang_path = get_toolchain_from_env('CLANG') |
645 | 650 |
|
@@ -717,6 +722,7 @@ def get_ccflags(self): |
717 | 722 | ccflags += list(sum([('-D', f'{define}={value}') for (define, value) in DEVICES[self.device]['defines'].items()], ())) |
718 | 723 | return ccflags |
719 | 724 |
|
| 725 | + |
720 | 726 | class Toolchain_Clang(Toolchain): |
721 | 727 | TARGET = { |
722 | 728 | 'CM0': 'thumbv6m-none-unknown-eabi', |
@@ -772,13 +778,82 @@ def get_ccflags(self): |
772 | 778 |
|
773 | 779 | return ccflags |
774 | 780 |
|
| 781 | + |
| 782 | +class Toolchain_IAR(Toolchain): |
| 783 | + OPTIMIZE = { |
| 784 | + 'none': '-Ol', |
| 785 | + 'balanced': '-Oh', |
| 786 | + 'speed': '-Ohs', |
| 787 | + 'size': '-Ohz' |
| 788 | + } |
| 789 | + |
| 790 | + CPU = { |
| 791 | + 'CM0': 'cortex-m0', |
| 792 | + 'CM0plus': 'cortex-m0+', |
| 793 | + 'CM3': 'cortex-m3', |
| 794 | + 'CM4': 'cortex-m4', |
| 795 | + 'CM4FP': 'cortex-m4.fp.sp', |
| 796 | + 'CM7': 'cortex-m7', |
| 797 | + 'CM7SP': 'cortex-m7.fp.sp', |
| 798 | + 'CM7DP': 'cortex-m7.fp.dp', |
| 799 | + 'CM23': 'cortex-m.no_se', |
| 800 | + 'CM23S': 'cortex-m', |
| 801 | + 'CM23NS': 'cortex-m', |
| 802 | + 'CM33': 'cortex-m.no_se', |
| 803 | + 'CM33S': 'cortex-m', |
| 804 | + 'CM33NS': 'cortex-m', |
| 805 | + 'CM35P': 'cortex-m.no_se', |
| 806 | + 'CM35PS': 'cortex-m', |
| 807 | + 'CM35PNS': 'cortex-m', |
| 808 | + 'CM55': 'cortex-m.no_se', |
| 809 | + 'CM55S': 'cortex-m', |
| 810 | + 'CM55NS': 'cortex-m', |
| 811 | + 'CM85': 'cortex-m.no_se', |
| 812 | + 'CM85S': 'cortex-m', |
| 813 | + 'CM85NS': 'cortex-m', |
| 814 | + 'CA5': 'cortex-a5', |
| 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' |
| 820 | + } |
| 821 | + |
| 822 | + FPU = { |
| 823 | + 'none': 'none', |
| 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' |
| 830 | + } |
| 831 | + |
| 832 | + def __init__(self, **args): |
| 833 | + super().__init__('IAR', **args) |
| 834 | + |
| 835 | + def get_cc(self): |
| 836 | + return os.path.join(self.get_root(), 'iccarm') |
| 837 | + |
| 838 | + def get_ccflags(self): |
| 839 | + ccflags = [ |
| 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()], ())) |
| 845 | + return ccflags |
| 846 | + |
| 847 | + |
775 | 848 | tc = None |
776 | 849 | if toolchain == 'AC6': |
777 | 850 | tc = Toolchain_AC6(device=device, optimize=optimize) |
778 | 851 | elif toolchain == 'GCC': |
779 | 852 | tc = Toolchain_GCC(device=device, optimize=optimize) |
780 | 853 | elif toolchain == 'Clang': |
781 | 854 | tc = Toolchain_Clang(device=device, optimize=optimize) |
| 855 | +elif toolchain == 'IAR': |
| 856 | + tc = Toolchain_IAR(device=device, optimize=optimize) |
782 | 857 |
|
783 | 858 | prefixes = ['CHECK'] |
784 | 859 | if device.endswith('NS'): |
|
0 commit comments