Clone of official tools

Committer:
The Other Jimmy
Date:
Thu Jun 22 11:12:28 2017 -0500
Revision:
36:96847d42f010
Parent:
31:8ea194f6145b
Tools release 5.5.1

Who changed what in which revision?

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