nkjnm

Dependencies:   MAX44000 nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Committer:
nexpaq
Date:
Sat Sep 17 16:32:05 2016 +0000
Revision:
1:55a6170b404f
checking in for sharing

Who changed what in which revision?

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