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
options.py
00001 """ 00002 mbed SDK 00003 Copyright (c) 2011-2013 ARM Limited 00004 00005 Licensed under the Apache License, Version 2.0 (the "License"); 00006 you may not use this file except in compliance with the License. 00007 You may obtain a copy of the License at 00008 00009 http://www.apache.org/licenses/LICENSE-2.0 00010 00011 Unless required by applicable law or agreed to in writing, software 00012 distributed under the License is distributed on an "AS IS" BASIS, 00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 See the License for the specific language governing permissions and 00015 limitations under the License. 00016 """ 00017 from argparse import ArgumentParser 00018 from tools.toolchains import TOOLCHAINS 00019 from tools.targets import TARGET_NAMES 00020 from tools.utils import argparse_force_uppercase_type, \ 00021 argparse_lowercase_hyphen_type, argparse_many, \ 00022 argparse_filestring_type 00023 00024 def get_default_options_parser (add_clean=True, add_options=True, 00025 add_app_config=False): 00026 """Create a new options parser with the default compiler options added 00027 00028 Keyword arguments: 00029 add_clean - add the clean argument? 00030 add_options - add the options argument? 00031 """ 00032 parser = ArgumentParser() 00033 00034 targetnames = TARGET_NAMES 00035 targetnames.sort() 00036 toolchainlist = list(TOOLCHAINS) 00037 toolchainlist.sort() 00038 00039 parser.add_argument("-m", "--mcu", 00040 help=("build for the given MCU (%s)" % 00041 ', '.join(targetnames)), 00042 metavar="MCU", 00043 type=argparse_many( 00044 argparse_force_uppercase_type( 00045 targetnames, "MCU"))) 00046 00047 parser.add_argument("-t", "--tool", 00048 help=("build using the given TOOLCHAIN (%s)" % 00049 ', '.join(toolchainlist)), 00050 metavar="TOOLCHAIN", 00051 type=argparse_many( 00052 argparse_force_uppercase_type( 00053 toolchainlist, "toolchain"))) 00054 00055 parser.add_argument("--color", 00056 help="print Warnings, and Errors in color", 00057 action="store_true", default=False) 00058 00059 parser.add_argument("--cflags", default=[], action="append", 00060 help="Extra flags to provide to the C compiler") 00061 00062 parser.add_argument("--asmflags", default=[], action="append", 00063 help="Extra flags to provide to the assembler") 00064 00065 parser.add_argument("--ldflags", default=[], action="append", 00066 help="Extra flags to provide to the linker") 00067 00068 if add_clean: 00069 parser.add_argument("-c", "--clean", action="store_true", default=False, 00070 help="clean the build directory") 00071 00072 if add_options: 00073 parser.add_argument("-o", "--options", action="append", 00074 help=('Add a build argument ("save-asm": save the ' 00075 'asm generated by the compiler, "debug-info":' 00076 ' generate debugging information, "analyze": ' 00077 'run Goanna static code analyzer")'), 00078 type=argparse_lowercase_hyphen_type(['save-asm', 00079 'debug-info', 00080 'analyze', 00081 'small-lib', 00082 'std-lib'], 00083 "build option")) 00084 00085 if add_app_config: 00086 parser.add_argument("--app-config", default=None, dest="app_config", 00087 type=argparse_filestring_type, 00088 help="Path of an app configuration file (Default is to look for 'mbed_app.json')") 00089 00090 return parser
Generated on Tue Jul 12 2022 12:28:46 by
