Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
detect_targets.py
00001 #! /usr/bin/env python2 00002 """ 00003 mbed SDK 00004 Copyright (c) 2011-2013 ARM Limited 00005 00006 Licensed under the Apache License, Version 2.0 (the "License"); 00007 you may not use this file except in compliance with the License. 00008 You may obtain a copy of the License at 00009 00010 http://www.apache.org/licenses/LICENSE-2.0 00011 00012 Unless required by applicable law or agreed to in writing, software 00013 distributed under the License is distributed on an "AS IS" BASIS, 00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 See the License for the specific language governing permissions and 00016 limitations under the License. 00017 """ 00018 import sys 00019 import os 00020 00021 ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) 00022 sys.path.insert(0, ROOT) 00023 00024 from tools.options import get_default_options_parser 00025 00026 # Check: Extra modules which are required by core test suite 00027 from tools.utils import check_required_modules 00028 check_required_modules(['prettytable']) 00029 00030 # Imports related to mbed build api 00031 from tools.build_api import mcu_toolchain_matrix 00032 from tools.test_api import get_autodetected_MUTS_list 00033 00034 00035 def main(): 00036 """Entry Point""" 00037 try: 00038 # Parse Options 00039 parser = get_default_options_parser() 00040 00041 parser.add_argument("-S", "--supported-toolchains", 00042 action="store_true", 00043 dest="supported_toolchains", 00044 default=False, 00045 help="Displays supported matrix of" 00046 " targets and toolchains") 00047 00048 parser.add_argument('-f', '--filter', 00049 dest='general_filter_regex', 00050 default=None, 00051 help='Filter targets') 00052 00053 parser.add_argument("-v", "--verbose", 00054 action="store_true", 00055 dest="verbose", 00056 default=False, 00057 help="Verbose diagnostic output") 00058 00059 options = parser.parse_args() 00060 00061 # Only prints matrix of supported toolchains 00062 if options.supported_toolchains: 00063 print mcu_toolchain_matrix( 00064 platform_filter=options.general_filter_regex) 00065 exit(0) 00066 00067 # If auto_detect attribute is present, we assume other auto-detection 00068 # parameters like 'toolchains_filter' are also set. 00069 muts = get_autodetected_MUTS_list() 00070 00071 count = 0 00072 for mut in muts.values(): 00073 print "" 00074 print "[mbed] Detected %s, port %s, mounted %s" % \ 00075 (mut['mcu'], mut['port'], mut['disk']) 00076 print "[mbed] Supported toolchains for %s" % mut['mcu'] 00077 print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$') 00078 count += 1 00079 00080 if count == 0: 00081 print "[mbed] No mbed targets where detected on your system." 00082 00083 except KeyboardInterrupt: 00084 print "\n[CTRL+c] exit" 00085 except Exception as exc: 00086 import traceback 00087 traceback.print_exc(file=sys.stdout) 00088 print "[ERROR] %s" % str(exc) 00089 sys.exit(1) 00090 00091 if __name__ == '__main__': 00092 main()
Generated on Tue Jul 12 2022 12:28:29 by
