Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:02dd72d1d465 1 """
borlanic 0:02dd72d1d465 2 mbed SDK
borlanic 0:02dd72d1d465 3 Copyright (c) 2011-2013 ARM Limited
borlanic 0:02dd72d1d465 4
borlanic 0:02dd72d1d465 5 Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:02dd72d1d465 6 you may not use this file except in compliance with the License.
borlanic 0:02dd72d1d465 7 You may obtain a copy of the License at
borlanic 0:02dd72d1d465 8
borlanic 0:02dd72d1d465 9 http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:02dd72d1d465 10
borlanic 0:02dd72d1d465 11 Unless required by applicable law or agreed to in writing, software
borlanic 0:02dd72d1d465 12 distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:02dd72d1d465 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:02dd72d1d465 14 See the License for the specific language governing permissions and
borlanic 0:02dd72d1d465 15 limitations under the License.
borlanic 0:02dd72d1d465 16 """
borlanic 0:02dd72d1d465 17 from tools.paths import MBED_LIBRARIES,\
borlanic 0:02dd72d1d465 18 MBED_RPC, RPC_LIBRARY, USB, USB_LIBRARIES, \
borlanic 0:02dd72d1d465 19 DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\
borlanic 0:02dd72d1d465 20 CPPUTEST_SRC,\
borlanic 0:02dd72d1d465 21 CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR, CPPUTEST_LIBRARY,\
borlanic 0:02dd72d1d465 22 CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC,\
borlanic 0:02dd72d1d465 23 CPPUTEST_INC_EXT
borlanic 0:02dd72d1d465 24 from tools.data.support import DEFAULT_SUPPORT
borlanic 0:02dd72d1d465 25 from tools.tests import TEST_MBED_LIB
borlanic 0:02dd72d1d465 26
borlanic 0:02dd72d1d465 27
borlanic 0:02dd72d1d465 28 LIBRARIES = [
borlanic 0:02dd72d1d465 29 # RPC
borlanic 0:02dd72d1d465 30 {
borlanic 0:02dd72d1d465 31 "id": "rpc",
borlanic 0:02dd72d1d465 32 "source_dir": MBED_RPC,
borlanic 0:02dd72d1d465 33 "build_dir": RPC_LIBRARY,
borlanic 0:02dd72d1d465 34 "dependencies": [MBED_LIBRARIES],
borlanic 0:02dd72d1d465 35 },
borlanic 0:02dd72d1d465 36
borlanic 0:02dd72d1d465 37 # USB Device libraries
borlanic 0:02dd72d1d465 38 {
borlanic 0:02dd72d1d465 39 "id": "usb",
borlanic 0:02dd72d1d465 40 "source_dir": USB,
borlanic 0:02dd72d1d465 41 "build_dir": USB_LIBRARIES,
borlanic 0:02dd72d1d465 42 "dependencies": [MBED_LIBRARIES],
borlanic 0:02dd72d1d465 43 },
borlanic 0:02dd72d1d465 44
borlanic 0:02dd72d1d465 45 # DSP libraries
borlanic 0:02dd72d1d465 46 {
borlanic 0:02dd72d1d465 47 "id": "dsp",
borlanic 0:02dd72d1d465 48 "source_dir": [DSP_ABSTRACTION, DSP_CMSIS],
borlanic 0:02dd72d1d465 49 "build_dir": DSP_LIBRARIES,
borlanic 0:02dd72d1d465 50 "dependencies": [MBED_LIBRARIES]
borlanic 0:02dd72d1d465 51 },
borlanic 0:02dd72d1d465 52
borlanic 0:02dd72d1d465 53 # Unit Testing library
borlanic 0:02dd72d1d465 54 {
borlanic 0:02dd72d1d465 55 "id": "cpputest",
borlanic 0:02dd72d1d465 56 "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC,
borlanic 0:02dd72d1d465 57 CPPUTEST_TESTRUNNER_SCR],
borlanic 0:02dd72d1d465 58 "build_dir": CPPUTEST_LIBRARY,
borlanic 0:02dd72d1d465 59 "dependencies": [MBED_LIBRARIES],
borlanic 0:02dd72d1d465 60 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC,
borlanic 0:02dd72d1d465 61 CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB],
borlanic 0:02dd72d1d465 62 'inc_dirs_ext': [CPPUTEST_INC_EXT],
borlanic 0:02dd72d1d465 63 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0",
borlanic 0:02dd72d1d465 64 "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"],
borlanic 0:02dd72d1d465 65 },
borlanic 0:02dd72d1d465 66 ]
borlanic 0:02dd72d1d465 67
borlanic 0:02dd72d1d465 68
borlanic 0:02dd72d1d465 69 LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES])
borlanic 0:02dd72d1d465 70
borlanic 0:02dd72d1d465 71
borlanic 0:02dd72d1d465 72 class Library(object):
borlanic 0:02dd72d1d465 73 """A library representation that allows for querying of support"""
borlanic 0:02dd72d1d465 74 def __init__(self, lib_id):
borlanic 0:02dd72d1d465 75 lib = LIBRARY_MAP[lib_id]
borlanic 0:02dd72d1d465 76 self.supported = lib.get("supported", DEFAULT_SUPPORT)
borlanic 0:02dd72d1d465 77 self.dependencies = lib.get("dependencies", None)
borlanic 0:02dd72d1d465 78 # Include dirs required by library build
borlanic 0:02dd72d1d465 79 self.inc_dirs = lib.get("inc_dirs", None)
borlanic 0:02dd72d1d465 80 # Include dirs required by others to use with this library
borlanic 0:02dd72d1d465 81 self.inc_dirs_ext = lib.get("inc_dirs_ext", None)
borlanic 0:02dd72d1d465 82 # Additional macros you want to define when building library
borlanic 0:02dd72d1d465 83 self.macros = lib.get("macros", None)
borlanic 0:02dd72d1d465 84
borlanic 0:02dd72d1d465 85 self.source_dir = lib["source_dir"]
borlanic 0:02dd72d1d465 86 self.build_dir = lib["build_dir"]
borlanic 0:02dd72d1d465 87
borlanic 0:02dd72d1d465 88 def is_supported(self, target, toolchain):
borlanic 0:02dd72d1d465 89 """Check if a target toolchain combination is supported
borlanic 0:02dd72d1d465 90
borlanic 0:02dd72d1d465 91 Positional arguments:
borlanic 0:02dd72d1d465 92 target - the MCU or board
borlanic 0:02dd72d1d465 93 toolchain - the compiler
borlanic 0:02dd72d1d465 94 """
borlanic 0:02dd72d1d465 95 if not hasattr(self, 'supported'):
borlanic 0:02dd72d1d465 96 return True
borlanic 0:02dd72d1d465 97 return (target.name in self.supported) and \
borlanic 0:02dd72d1d465 98 (toolchain in self.supported[target.name])