mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 #! /usr/bin/env python2
elessair 0:f269e3021894 2 """
elessair 0:f269e3021894 3 mbed SDK
elessair 0:f269e3021894 4 Copyright (c) 2011-2013 ARM Limited
elessair 0:f269e3021894 5
elessair 0:f269e3021894 6 Licensed under the Apache License, Version 2.0 (the "License");
elessair 0:f269e3021894 7 you may not use this file except in compliance with the License.
elessair 0:f269e3021894 8 You may obtain a copy of the License at
elessair 0:f269e3021894 9
elessair 0:f269e3021894 10 http://www.apache.org/licenses/LICENSE-2.0
elessair 0:f269e3021894 11
elessair 0:f269e3021894 12 Unless required by applicable law or agreed to in writing, software
elessair 0:f269e3021894 13 distributed under the License is distributed on an "AS IS" BASIS,
elessair 0:f269e3021894 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
elessair 0:f269e3021894 15 See the License for the specific language governing permissions and
elessair 0:f269e3021894 16 limitations under the License.
elessair 0:f269e3021894 17 """
elessair 0:f269e3021894 18 import sys
elessair 0:f269e3021894 19 import os
elessair 0:f269e3021894 20
elessair 0:f269e3021894 21 ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
elessair 0:f269e3021894 22 sys.path.insert(0, ROOT)
elessair 0:f269e3021894 23
elessair 0:f269e3021894 24 from tools.options import get_default_options_parser
elessair 0:f269e3021894 25
elessair 0:f269e3021894 26 # Check: Extra modules which are required by core test suite
elessair 0:f269e3021894 27 from tools.utils import check_required_modules
elessair 0:f269e3021894 28 check_required_modules(['prettytable'])
elessair 0:f269e3021894 29
elessair 0:f269e3021894 30 # Imports related to mbed build api
elessair 0:f269e3021894 31 from tools.build_api import mcu_toolchain_matrix
elessair 0:f269e3021894 32 from tools.test_api import get_autodetected_MUTS_list
elessair 0:f269e3021894 33
elessair 0:f269e3021894 34
elessair 0:f269e3021894 35 def main():
elessair 0:f269e3021894 36 """Entry Point"""
elessair 0:f269e3021894 37 try:
elessair 0:f269e3021894 38 # Parse Options
elessair 0:f269e3021894 39 parser = get_default_options_parser()
elessair 0:f269e3021894 40
elessair 0:f269e3021894 41 parser.add_argument("-S", "--supported-toolchains",
elessair 0:f269e3021894 42 action="store_true",
elessair 0:f269e3021894 43 dest="supported_toolchains",
elessair 0:f269e3021894 44 default=False,
elessair 0:f269e3021894 45 help="Displays supported matrix of"
elessair 0:f269e3021894 46 " targets and toolchains")
elessair 0:f269e3021894 47
elessair 0:f269e3021894 48 parser.add_argument('-f', '--filter',
elessair 0:f269e3021894 49 dest='general_filter_regex',
elessair 0:f269e3021894 50 default=None,
elessair 0:f269e3021894 51 help='Filter targets')
elessair 0:f269e3021894 52
elessair 0:f269e3021894 53 parser.add_argument("-v", "--verbose",
elessair 0:f269e3021894 54 action="store_true",
elessair 0:f269e3021894 55 dest="verbose",
elessair 0:f269e3021894 56 default=False,
elessair 0:f269e3021894 57 help="Verbose diagnostic output")
elessair 0:f269e3021894 58
elessair 0:f269e3021894 59 options = parser.parse_args()
elessair 0:f269e3021894 60
elessair 0:f269e3021894 61 # Only prints matrix of supported toolchains
elessair 0:f269e3021894 62 if options.supported_toolchains:
elessair 0:f269e3021894 63 print mcu_toolchain_matrix(
elessair 0:f269e3021894 64 platform_filter=options.general_filter_regex)
elessair 0:f269e3021894 65 exit(0)
elessair 0:f269e3021894 66
elessair 0:f269e3021894 67 # If auto_detect attribute is present, we assume other auto-detection
elessair 0:f269e3021894 68 # parameters like 'toolchains_filter' are also set.
elessair 0:f269e3021894 69 muts = get_autodetected_MUTS_list()
elessair 0:f269e3021894 70
elessair 0:f269e3021894 71 count = 0
elessair 0:f269e3021894 72 for mut in muts.values():
elessair 0:f269e3021894 73 print ""
elessair 0:f269e3021894 74 print "[mbed] Detected %s, port %s, mounted %s" % \
elessair 0:f269e3021894 75 (mut['mcu'], mut['port'], mut['disk'])
elessair 0:f269e3021894 76 print "[mbed] Supported toolchains for %s" % mut['mcu']
elessair 0:f269e3021894 77 print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
elessair 0:f269e3021894 78 count += 1
elessair 0:f269e3021894 79
elessair 0:f269e3021894 80 if count == 0:
elessair 0:f269e3021894 81 print "[mbed] No mbed targets where detected on your system."
elessair 0:f269e3021894 82
elessair 0:f269e3021894 83 except KeyboardInterrupt:
elessair 0:f269e3021894 84 print "\n[CTRL+c] exit"
elessair 0:f269e3021894 85 except Exception as exc:
elessair 0:f269e3021894 86 import traceback
elessair 0:f269e3021894 87 traceback.print_exc(file=sys.stdout)
elessair 0:f269e3021894 88 print "[ERROR] %s" % str(exc)
elessair 0:f269e3021894 89 sys.exit(1)
elessair 0:f269e3021894 90
elessair 0:f269e3021894 91 if __name__ == '__main__':
elessair 0:f269e3021894 92 main()