36
36
from jinja2 .environment import Environment
37
37
from tools .config import Config
38
38
39
+ RELEASE_VERSIONS = ['2' , '5' ]
40
+
39
41
def prep_report (report , target_name , toolchain_name , id_name ):
40
42
# Setup report keys
41
43
if not target_name in report :
@@ -116,9 +118,9 @@ def is_official_target(target_name, version):
116
118
""" Returns True, None if a target is part of the official release for the
117
119
given version. Return False, 'reason' if a target is not part of the
118
120
official release for the given version.
119
-
120
- target_name: name if the target (ex. 'K64F')
121
- version: string of the version (ex. '2' or '5')
121
+
122
+ target_name: Name if the target (ex. 'K64F')
123
+ version: The release version string. Should be a string contained within RELEASE_VERSIONS
122
124
"""
123
125
124
126
result = True
@@ -154,6 +156,11 @@ def is_official_target(target_name, version):
154
156
(("official release: %s" + linesep ) % ", " .join (required_toolchains_sorted )) + \
155
157
("Currently it is only configured to support the " ) + \
156
158
("following toolchains: %s" % ", " .join (supported_toolchains_sorted ))
159
+ else :
160
+ result = False
161
+ reason = ("Target '%s' has set an invalid release version of '%s'" % version ) + \
162
+ ("Please choose from the following release versions: %s" + ', ' .join (RELEASE_VERSIONS ))
163
+
157
164
else :
158
165
result = False
159
166
if not hasattr (target , 'release' ):
@@ -163,14 +170,35 @@ def is_official_target(target_name, version):
163
170
164
171
return result , reason
165
172
173
+ def transform_release_toolchains (toolchains , version ):
174
+ """ Given a list of toolchains and a release version, return a list of
175
+ only the supported toolchains for that release
176
+
177
+ toolchains: The list of toolchains
178
+ version: The release version string. Should be a string contained within RELEASE_VERSIONS
179
+ """
180
+ toolchains_set = set (toolchains )
181
+
182
+ if version == '5' :
183
+ return ['ARM' , 'GCC_ARM' , 'IAR' ]
184
+ else :
185
+ return toolchains
186
+
166
187
167
188
def get_mbed_official_release (version ):
189
+ """ Given a release version string, return a tuple that contains a target
190
+ and the supported toolchains for that release.
191
+ Ex. Given '2', return (('LPC1768', ('ARM', 'GCC_ARM')), ('K64F', ('ARM', 'GCC_ARM')), ...)
192
+
193
+ version: The version string. Should be a string contained within RELEASE_VERSIONS
194
+ """
195
+
168
196
MBED_OFFICIAL_RELEASE = (
169
197
tuple (
170
198
tuple (
171
199
[
172
200
TARGET_MAP [target ].name ,
173
- tuple (TARGET_MAP [target ].supported_toolchains )
201
+ tuple (transform_release_toolchains ( TARGET_MAP [target ].supported_toolchains , version ) )
174
202
]
175
203
) for target in TARGET_NAMES if (hasattr (TARGET_MAP [target ], 'release' ) and version in TARGET_MAP [target ].release )
176
204
)
@@ -719,39 +747,88 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
719
747
raise e
720
748
721
749
722
- def get_unique_supported_toolchains ():
723
- """ Get list of all unique toolchains supported by targets """
750
+ def get_unique_supported_toolchains (release_targets = None ):
751
+ """ Get list of all unique toolchains supported by targets
752
+ If release_targets is not specified, then it queries all known targets
753
+ release_targets: tuple structure returned from get_mbed_official_release()
754
+ """
724
755
unique_supported_toolchains = []
725
- for target in TARGET_NAMES :
726
- for toolchain in TARGET_MAP [target ].supported_toolchains :
727
- if toolchain not in unique_supported_toolchains :
728
- unique_supported_toolchains .append (toolchain )
756
+
757
+ if not release_targets :
758
+ for target in TARGET_NAMES :
759
+ for toolchain in TARGET_MAP [target ].supported_toolchains :
760
+ if toolchain not in unique_supported_toolchains :
761
+ unique_supported_toolchains .append (toolchain )
762
+ else :
763
+ for target in release_targets :
764
+ for toolchain in target [1 ]:
765
+ if toolchain not in unique_supported_toolchains :
766
+ unique_supported_toolchains .append (toolchain )
767
+
729
768
return unique_supported_toolchains
730
769
731
770
732
- def mcu_toolchain_matrix (verbose_html = False , platform_filter = None ):
771
+ def mcu_toolchain_matrix (verbose_html = False , platform_filter = None , release_version = '5' ):
733
772
""" Shows target map using prettytable """
734
- unique_supported_toolchains = get_unique_supported_toolchains ()
735
773
from prettytable import PrettyTable # Only use it in this function so building works without extra modules
736
774
775
+ if isinstance (release_version , basestring ):
776
+ # Force release_version to lowercase if it is a string
777
+ release_version = release_version .lower ()
778
+ else :
779
+ # Otherwise default to printing all known targets and toolchains
780
+ release_version = 'all'
781
+
782
+
783
+ version_release_targets = {}
784
+ version_release_target_names = {}
785
+
786
+ for version in RELEASE_VERSIONS :
787
+ version_release_targets [version ] = get_mbed_official_release (version )
788
+ version_release_target_names [version ] = [x [0 ] for x in version_release_targets [version ]]
789
+
790
+ if release_version in RELEASE_VERSIONS :
791
+ release_targets = version_release_targets [release_version ]
792
+ else :
793
+ release_targets = None
794
+
795
+ unique_supported_toolchains = get_unique_supported_toolchains (release_targets )
796
+ prepend_columns = ["Target" ] + ["mbed OS %s" % x for x in RELEASE_VERSIONS ]
797
+
737
798
# All tests status table print
738
- columns = [ "Target" ] + unique_supported_toolchains
739
- pt = PrettyTable ([ "Target" ] + unique_supported_toolchains )
799
+ columns = prepend_columns + unique_supported_toolchains
800
+ pt = PrettyTable (columns )
740
801
# Align table
741
802
for col in columns :
742
803
pt .align [col ] = "c"
743
804
pt .align ["Target" ] = "l"
744
805
745
806
perm_counter = 0
746
807
target_counter = 0
747
- for target in sorted (TARGET_NAMES ):
808
+
809
+ target_names = []
810
+
811
+ if release_targets :
812
+ target_names = [x [0 ] for x in release_targets ]
813
+ else :
814
+ target_names = TARGET_NAMES
815
+
816
+ for target in sorted (target_names ):
748
817
if platform_filter is not None :
749
818
# FIlter out platforms using regex
750
819
if re .search (platform_filter , target ) is None :
751
820
continue
752
821
target_counter += 1
753
822
754
823
row = [target ] # First column is platform name
824
+
825
+ for version in RELEASE_VERSIONS :
826
+ if target in version_release_target_names [version ]:
827
+ text = "Supported"
828
+ else :
829
+ text = "-"
830
+ row .append (text )
831
+
755
832
for unique_toolchain in unique_supported_toolchains :
756
833
if unique_toolchain in TARGET_MAP [target ].supported_toolchains :
757
834
text = "Supported"
0 commit comments