Committer:
borlanic
Date:
Fri Mar 30 14:07:05 2018 +0000
Revision:
4:75df35ef4fb6
Parent:
0:380207fcb5c1
commentar

Who changed what in which revision?

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