nkjnm

Dependencies:   MAX44000 nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Committer:
nitsshukla
Date:
Fri Nov 04 12:06:04 2016 +0000
Revision:
7:3a65ef12ba31
Parent:
1:55a6170b404f
kghj;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 1:55a6170b404f 1 """
nexpaq 1:55a6170b404f 2 mbed SDK
nexpaq 1:55a6170b404f 3 Copyright (c) 2011-2013 ARM Limited
nexpaq 1:55a6170b404f 4
nexpaq 1:55a6170b404f 5 Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 1:55a6170b404f 6 you may not use this file except in compliance with the License.
nexpaq 1:55a6170b404f 7 You may obtain a copy of the License at
nexpaq 1:55a6170b404f 8
nexpaq 1:55a6170b404f 9 http://www.apache.org/licenses/LICENSE-2.0
nexpaq 1:55a6170b404f 10
nexpaq 1:55a6170b404f 11 Unless required by applicable law or agreed to in writing, software
nexpaq 1:55a6170b404f 12 distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 1:55a6170b404f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 1:55a6170b404f 14 See the License for the specific language governing permissions and
nexpaq 1:55a6170b404f 15 limitations under the License.
nexpaq 1:55a6170b404f 16 """
nexpaq 1:55a6170b404f 17 from argparse import ArgumentParser
nexpaq 1:55a6170b404f 18 from tools.toolchains import TOOLCHAINS
nexpaq 1:55a6170b404f 19 from tools.targets import TARGET_NAMES
nexpaq 1:55a6170b404f 20 from tools.utils import argparse_force_uppercase_type, \
nexpaq 1:55a6170b404f 21 argparse_lowercase_hyphen_type, argparse_many, \
nexpaq 1:55a6170b404f 22 argparse_filestring_type
nexpaq 1:55a6170b404f 23
nexpaq 1:55a6170b404f 24 def get_default_options_parser(add_clean=True, add_options=True,
nexpaq 1:55a6170b404f 25 add_app_config=False):
nexpaq 1:55a6170b404f 26 """Create a new options parser with the default compiler options added
nexpaq 1:55a6170b404f 27
nexpaq 1:55a6170b404f 28 Keyword arguments:
nexpaq 1:55a6170b404f 29 add_clean - add the clean argument?
nexpaq 1:55a6170b404f 30 add_options - add the options argument?
nexpaq 1:55a6170b404f 31 """
nexpaq 1:55a6170b404f 32 parser = ArgumentParser()
nexpaq 1:55a6170b404f 33
nexpaq 1:55a6170b404f 34 targetnames = TARGET_NAMES
nexpaq 1:55a6170b404f 35 targetnames.sort()
nexpaq 1:55a6170b404f 36 toolchainlist = list(TOOLCHAINS)
nexpaq 1:55a6170b404f 37 toolchainlist.sort()
nexpaq 1:55a6170b404f 38
nexpaq 1:55a6170b404f 39 parser.add_argument("-m", "--mcu",
nexpaq 1:55a6170b404f 40 help=("build for the given MCU (%s)" %
nexpaq 1:55a6170b404f 41 ', '.join(targetnames)),
nexpaq 1:55a6170b404f 42 metavar="MCU",
nexpaq 1:55a6170b404f 43 type=argparse_many(
nexpaq 1:55a6170b404f 44 argparse_force_uppercase_type(
nexpaq 1:55a6170b404f 45 targetnames, "MCU")))
nexpaq 1:55a6170b404f 46
nexpaq 1:55a6170b404f 47 parser.add_argument("-t", "--tool",
nexpaq 1:55a6170b404f 48 help=("build using the given TOOLCHAIN (%s)" %
nexpaq 1:55a6170b404f 49 ', '.join(toolchainlist)),
nexpaq 1:55a6170b404f 50 metavar="TOOLCHAIN",
nexpaq 1:55a6170b404f 51 type=argparse_many(
nexpaq 1:55a6170b404f 52 argparse_force_uppercase_type(
nexpaq 1:55a6170b404f 53 toolchainlist, "toolchain")))
nexpaq 1:55a6170b404f 54
nexpaq 1:55a6170b404f 55 parser.add_argument("--color",
nexpaq 1:55a6170b404f 56 help="print Warnings, and Errors in color",
nexpaq 1:55a6170b404f 57 action="store_true", default=False)
nexpaq 1:55a6170b404f 58
nexpaq 1:55a6170b404f 59 parser.add_argument("--cflags", default=[], action="append",
nexpaq 1:55a6170b404f 60 help="Extra flags to provide to the C compiler")
nexpaq 1:55a6170b404f 61
nexpaq 1:55a6170b404f 62 parser.add_argument("--asmflags", default=[], action="append",
nexpaq 1:55a6170b404f 63 help="Extra flags to provide to the assembler")
nexpaq 1:55a6170b404f 64
nexpaq 1:55a6170b404f 65 parser.add_argument("--ldflags", default=[], action="append",
nexpaq 1:55a6170b404f 66 help="Extra flags to provide to the linker")
nexpaq 1:55a6170b404f 67
nexpaq 1:55a6170b404f 68 if add_clean:
nexpaq 1:55a6170b404f 69 parser.add_argument("-c", "--clean", action="store_true", default=False,
nexpaq 1:55a6170b404f 70 help="clean the build directory")
nexpaq 1:55a6170b404f 71
nexpaq 1:55a6170b404f 72 if add_options:
nexpaq 1:55a6170b404f 73 parser.add_argument("-o", "--options", action="append",
nexpaq 1:55a6170b404f 74 help=('Add a build argument ("save-asm": save the '
nexpaq 1:55a6170b404f 75 'asm generated by the compiler, "debug-info":'
nexpaq 1:55a6170b404f 76 ' generate debugging information, "analyze": '
nexpaq 1:55a6170b404f 77 'run Goanna static code analyzer")'),
nexpaq 1:55a6170b404f 78 type=argparse_lowercase_hyphen_type(['save-asm',
nexpaq 1:55a6170b404f 79 'debug-info',
nexpaq 1:55a6170b404f 80 'analyze',
nexpaq 1:55a6170b404f 81 'small-lib',
nexpaq 1:55a6170b404f 82 'std-lib'],
nexpaq 1:55a6170b404f 83 "build option"))
nexpaq 1:55a6170b404f 84
nexpaq 1:55a6170b404f 85 if add_app_config:
nexpaq 1:55a6170b404f 86 parser.add_argument("--app-config", default=None, dest="app_config",
nexpaq 1:55a6170b404f 87 type=argparse_filestring_type,
nexpaq 1:55a6170b404f 88 help="Path of an app configuration file (Default is to look for 'mbed_app.json')")
nexpaq 1:55a6170b404f 89
nexpaq 1:55a6170b404f 90 return parser