Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

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