Clone of official tools
libraries.py@0:66f3b5499f7f, 2016-05-19 (annotated)
- Committer:
- screamer
- Date:
- Thu May 19 19:44:41 2016 +0100
- Revision:
- 0:66f3b5499f7f
- Child:
- 13:ab47a20b66f0
Initial revision
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 | 0:66f3b5499f7f | 63 | "id": "cmsis_dsp", |
screamer | 0:66f3b5499f7f | 64 | "source_dir": DSP_CMSIS, |
screamer | 0:66f3b5499f7f | 65 | "build_dir": DSP_LIBRARIES, |
screamer | 0:66f3b5499f7f | 66 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 67 | }, |
screamer | 0:66f3b5499f7f | 68 | { |
screamer | 0:66f3b5499f7f | 69 | "id": "dsp", |
screamer | 0:66f3b5499f7f | 70 | "source_dir": DSP_ABSTRACTION, |
screamer | 0:66f3b5499f7f | 71 | "build_dir": DSP_LIBRARIES, |
screamer | 0:66f3b5499f7f | 72 | "dependencies": [MBED_LIBRARIES, DSP_CMSIS], |
screamer | 0:66f3b5499f7f | 73 | }, |
screamer | 0:66f3b5499f7f | 74 | |
screamer | 0:66f3b5499f7f | 75 | # File system libraries |
screamer | 0:66f3b5499f7f | 76 | { |
screamer | 0:66f3b5499f7f | 77 | "id": "fat", |
screamer | 0:66f3b5499f7f | 78 | "source_dir": [FAT_FS, SD_FS], |
screamer | 0:66f3b5499f7f | 79 | "build_dir": FS_LIBRARY, |
screamer | 0:66f3b5499f7f | 80 | "dependencies": [MBED_LIBRARIES] |
screamer | 0:66f3b5499f7f | 81 | }, |
screamer | 0:66f3b5499f7f | 82 | |
screamer | 0:66f3b5499f7f | 83 | # Network libraries |
screamer | 0:66f3b5499f7f | 84 | { |
screamer | 0:66f3b5499f7f | 85 | "id": "eth", |
screamer | 0:66f3b5499f7f | 86 | "source_dir": [ETH_SOURCES, LWIP_SOURCES], |
screamer | 0:66f3b5499f7f | 87 | "build_dir": ETH_LIBRARY, |
screamer | 0:66f3b5499f7f | 88 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES] |
screamer | 0:66f3b5499f7f | 89 | }, |
screamer | 0:66f3b5499f7f | 90 | |
screamer | 0:66f3b5499f7f | 91 | { |
screamer | 0:66f3b5499f7f | 92 | "id": "ublox", |
screamer | 0:66f3b5499f7f | 93 | "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, LWIP_SOURCES], |
screamer | 0:66f3b5499f7f | 94 | "build_dir": UBLOX_LIBRARY, |
screamer | 0:66f3b5499f7f | 95 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES], |
screamer | 0:66f3b5499f7f | 96 | }, |
screamer | 0:66f3b5499f7f | 97 | |
screamer | 0:66f3b5499f7f | 98 | # Unit Testing library |
screamer | 0:66f3b5499f7f | 99 | { |
screamer | 0:66f3b5499f7f | 100 | "id": "cpputest", |
screamer | 0:66f3b5499f7f | 101 | "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR], |
screamer | 0:66f3b5499f7f | 102 | "build_dir": CPPUTEST_LIBRARY, |
screamer | 0:66f3b5499f7f | 103 | "dependencies": [MBED_LIBRARIES], |
screamer | 0:66f3b5499f7f | 104 | 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB], |
screamer | 0:66f3b5499f7f | 105 | 'inc_dirs_ext': [CPPUTEST_INC_EXT], |
screamer | 0:66f3b5499f7f | 106 | 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"], |
screamer | 0:66f3b5499f7f | 107 | }, |
screamer | 0:66f3b5499f7f | 108 | ] |
screamer | 0:66f3b5499f7f | 109 | |
screamer | 0:66f3b5499f7f | 110 | |
screamer | 0:66f3b5499f7f | 111 | LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES]) |
screamer | 0:66f3b5499f7f | 112 | |
screamer | 0:66f3b5499f7f | 113 | |
screamer | 0:66f3b5499f7f | 114 | class Library: |
screamer | 0:66f3b5499f7f | 115 | DEFAULTS = { |
screamer | 0:66f3b5499f7f | 116 | "supported": DEFAULT_SUPPORT, |
screamer | 0:66f3b5499f7f | 117 | 'dependencies': None, |
screamer | 0:66f3b5499f7f | 118 | 'inc_dirs': None, # Include dirs required by library build |
screamer | 0:66f3b5499f7f | 119 | 'inc_dirs_ext': None, # Include dirs required by others to use with this library |
screamer | 0:66f3b5499f7f | 120 | 'macros': None, # Additional macros you want to define when building library |
screamer | 0:66f3b5499f7f | 121 | } |
screamer | 0:66f3b5499f7f | 122 | def __init__(self, lib_id): |
screamer | 0:66f3b5499f7f | 123 | self.__dict__.update(Library.DEFAULTS) |
screamer | 0:66f3b5499f7f | 124 | self.__dict__.update(LIBRARY_MAP[lib_id]) |
screamer | 0:66f3b5499f7f | 125 | |
screamer | 0:66f3b5499f7f | 126 | def is_supported(self, target, toolchain): |
screamer | 0:66f3b5499f7f | 127 | if not hasattr(self, 'supported'): |
screamer | 0:66f3b5499f7f | 128 | return True |
screamer | 0:66f3b5499f7f | 129 | return (target.name in self.supported) and (toolchain in self.supported[target.name]) |