Clone of official tools
libraries.py@13:ab47a20b66f0, 2016-07-14 (annotated)
- Committer:
- screamer
- Date:
- Thu Jul 14 20:21:19 2016 +0100
- Revision:
- 13:ab47a20b66f0
- Parent:
- 0:66f3b5499f7f
- Child:
- 29:1210849dba19
Apply latest tools
Who changed what in which revision?
User | Revision | Line number | New 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 | """ |
screamer | 0:66f3b5499f7f | 17 | from tools.paths import * |
screamer | 0:66f3b5499f7f | 18 | from tools.data.support import * |
screamer | 0:66f3b5499f7f | 19 | from tools.tests import TEST_MBED_LIB |
screamer | 0:66f3b5499f7f | 20 | |
screamer | 0:66f3b5499f7f | 21 | |
screamer | 0:66f3b5499f7f | 22 | LIBRARIES = [ |
screamer | 0:66f3b5499f7f | 23 | # RTOS libraries |
screamer | 0:66f3b5499f7f | 24 | { |
screamer | 0:66f3b5499f7f | 25 | "id": "rtx", |
screamer | 0:66f3b5499f7f | 26 | "source_dir": MBED_RTX, |
screamer | 0:66f3b5499f7f | 27 | "build_dir": RTOS_LIBRARIES, |
screamer | 0:66f3b5499f7f | 28 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 29 | }, |
screamer | 0:66f3b5499f7f | 30 | { |
screamer | 0:66f3b5499f7f | 31 | "id": "rtos", |
screamer | 0:66f3b5499f7f | 32 | "source_dir": RTOS_ABSTRACTION, |
screamer | 0:66f3b5499f7f | 33 | "build_dir": RTOS_LIBRARIES, |
screamer | 0:66f3b5499f7f | 34 | "dependencies": [MBED_LIBRARIES, MBED_RTX], |
screamer | 0:66f3b5499f7f | 35 | }, |
screamer | 0:66f3b5499f7f | 36 | |
screamer | 0:66f3b5499f7f | 37 | # RPC |
screamer | 0:66f3b5499f7f | 38 | { |
screamer | 0:66f3b5499f7f | 39 | "id": "rpc", |
screamer | 0:66f3b5499f7f | 40 | "source_dir": MBED_RPC, |
screamer | 0:66f3b5499f7f | 41 | "build_dir": RPC_LIBRARY, |
screamer | 0:66f3b5499f7f | 42 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 43 | }, |
screamer | 0:66f3b5499f7f | 44 | |
screamer | 0:66f3b5499f7f | 45 | # USB Device libraries |
screamer | 0:66f3b5499f7f | 46 | { |
screamer | 0:66f3b5499f7f | 47 | "id": "usb", |
screamer | 0:66f3b5499f7f | 48 | "source_dir": USB, |
screamer | 0:66f3b5499f7f | 49 | "build_dir": USB_LIBRARIES, |
screamer | 0:66f3b5499f7f | 50 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 51 | }, |
screamer | 0:66f3b5499f7f | 52 | |
screamer | 0:66f3b5499f7f | 53 | # USB Host libraries |
screamer | 0:66f3b5499f7f | 54 | { |
screamer | 0:66f3b5499f7f | 55 | "id": "usb_host", |
screamer | 0:66f3b5499f7f | 56 | "source_dir": USB_HOST, |
screamer | 0:66f3b5499f7f | 57 | "build_dir": USB_HOST_LIBRARIES, |
screamer | 0:66f3b5499f7f | 58 | "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION], |
screamer | 0:66f3b5499f7f | 59 | }, |
screamer | 0:66f3b5499f7f | 60 | |
screamer | 0:66f3b5499f7f | 61 | # DSP libraries |
screamer | 0:66f3b5499f7f | 62 | { |
screamer | 13:ab47a20b66f0 | 63 | "id": "dsp", |
screamer | 13:ab47a20b66f0 | 64 | "source_dir": [DSP_ABSTRACTION, DSP_CMSIS], |
screamer | 0:66f3b5499f7f | 65 | "build_dir": DSP_LIBRARIES, |
screamer | 13:ab47a20b66f0 | 66 | "dependencies": [MBED_LIBRARIES] |
screamer | 0:66f3b5499f7f | 67 | }, |
screamer | 0:66f3b5499f7f | 68 | |
screamer | 0:66f3b5499f7f | 69 | # File system libraries |
screamer | 0:66f3b5499f7f | 70 | { |
screamer | 0:66f3b5499f7f | 71 | "id": "fat", |
screamer | 0:66f3b5499f7f | 72 | "source_dir": [FAT_FS, SD_FS], |
screamer | 0:66f3b5499f7f | 73 | "build_dir": FS_LIBRARY, |
screamer | 0:66f3b5499f7f | 74 | "dependencies": [MBED_LIBRARIES] |
screamer | 0:66f3b5499f7f | 75 | }, |
screamer | 0:66f3b5499f7f | 76 | |
screamer | 0:66f3b5499f7f | 77 | # Network libraries |
screamer | 0:66f3b5499f7f | 78 | { |
screamer | 0:66f3b5499f7f | 79 | "id": "eth", |
screamer | 0:66f3b5499f7f | 80 | "source_dir": [ETH_SOURCES, LWIP_SOURCES], |
screamer | 0:66f3b5499f7f | 81 | "build_dir": ETH_LIBRARY, |
screamer | 0:66f3b5499f7f | 82 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES] |
screamer | 0:66f3b5499f7f | 83 | }, |
screamer | 0:66f3b5499f7f | 84 | |
screamer | 0:66f3b5499f7f | 85 | { |
screamer | 0:66f3b5499f7f | 86 | "id": "ublox", |
screamer | 0:66f3b5499f7f | 87 | "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, LWIP_SOURCES], |
screamer | 0:66f3b5499f7f | 88 | "build_dir": UBLOX_LIBRARY, |
screamer | 0:66f3b5499f7f | 89 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES], |
screamer | 0:66f3b5499f7f | 90 | }, |
screamer | 0:66f3b5499f7f | 91 | |
screamer | 0:66f3b5499f7f | 92 | # Unit Testing library |
screamer | 0:66f3b5499f7f | 93 | { |
screamer | 0:66f3b5499f7f | 94 | "id": "cpputest", |
screamer | 0:66f3b5499f7f | 95 | "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR], |
screamer | 0:66f3b5499f7f | 96 | "build_dir": CPPUTEST_LIBRARY, |
screamer | 0:66f3b5499f7f | 97 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 98 | 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB], |
screamer | 0:66f3b5499f7f | 99 | 'inc_dirs_ext': [CPPUTEST_INC_EXT], |
screamer | 0:66f3b5499f7f | 100 | 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"], |
screamer | 0:66f3b5499f7f | 101 | }, |
screamer | 0:66f3b5499f7f | 102 | ] |
screamer | 0:66f3b5499f7f | 103 | |
screamer | 0:66f3b5499f7f | 104 | |
screamer | 0:66f3b5499f7f | 105 | LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES]) |
screamer | 0:66f3b5499f7f | 106 | |
screamer | 0:66f3b5499f7f | 107 | |
screamer | 0:66f3b5499f7f | 108 | class Library: |
screamer | 0:66f3b5499f7f | 109 | DEFAULTS = { |
screamer | 0:66f3b5499f7f | 110 | "supported": DEFAULT_SUPPORT, |
screamer | 0:66f3b5499f7f | 111 | 'dependencies': None, |
screamer | 0:66f3b5499f7f | 112 | 'inc_dirs': None, # Include dirs required by library build |
screamer | 0:66f3b5499f7f | 113 | 'inc_dirs_ext': None, # Include dirs required by others to use with this library |
screamer | 0:66f3b5499f7f | 114 | 'macros': None, # Additional macros you want to define when building library |
screamer | 0:66f3b5499f7f | 115 | } |
screamer | 0:66f3b5499f7f | 116 | def __init__(self, lib_id): |
screamer | 0:66f3b5499f7f | 117 | self.__dict__.update(Library.DEFAULTS) |
screamer | 0:66f3b5499f7f | 118 | self.__dict__.update(LIBRARY_MAP[lib_id]) |
screamer | 0:66f3b5499f7f | 119 | |
screamer | 0:66f3b5499f7f | 120 | def is_supported(self, target, toolchain): |
screamer | 0:66f3b5499f7f | 121 | if not hasattr(self, 'supported'): |
screamer | 0:66f3b5499f7f | 122 | return True |
screamer | 0:66f3b5499f7f | 123 | return (target.name in self.supported) and (toolchain in self.supported[target.name]) |