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