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