Clone of official tools

Committer:
screamer
Date:
Mon Aug 29 11:18:36 2016 +0100
Revision:
29:1210849dba19
Parent:
13:ab47a20b66f0
Child:
31:8ea194f6145b
Port the latest tools patches from https://github.com/ARMmbed/mbed-os

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 """
screamer 29:1210849dba19 17 from tools.paths import MBED_RTX, RTOS_LIBRARIES, MBED_LIBRARIES, MBED_RPC,\
screamer 29:1210849dba19 18 RTOS_ABSTRACTION, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\
screamer 29:1210849dba19 19 USB_HOST_LIBRARIES, FAT_FS, DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\
screamer 29:1210849dba19 20 SD_FS, FS_LIBRARY, ETH_SOURCES, LWIP_SOURCES, ETH_LIBRARY, UBLOX_SOURCES,\
screamer 29:1210849dba19 21 UBLOX_LIBRARY, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, CPPUTEST_SRC,\
screamer 29:1210849dba19 22 CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR, CPPUTEST_LIBRARY,\
screamer 29:1210849dba19 23 CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC,\
screamer 29:1210849dba19 24 CPPUTEST_INC_EXT
screamer 29:1210849dba19 25 from tools.data.support import DEFAULT_SUPPORT
screamer 0:66f3b5499f7f 26 from tools.tests import TEST_MBED_LIB
screamer 0:66f3b5499f7f 27
screamer 0:66f3b5499f7f 28
screamer 0:66f3b5499f7f 29 LIBRARIES = [
screamer 0:66f3b5499f7f 30 # RTOS libraries
screamer 0:66f3b5499f7f 31 {
screamer 0:66f3b5499f7f 32 "id": "rtx",
screamer 0:66f3b5499f7f 33 "source_dir": MBED_RTX,
screamer 0:66f3b5499f7f 34 "build_dir": RTOS_LIBRARIES,
screamer 0:66f3b5499f7f 35 "dependencies": [MBED_LIBRARIES],
screamer 0:66f3b5499f7f 36 },
screamer 0:66f3b5499f7f 37 {
screamer 0:66f3b5499f7f 38 "id": "rtos",
screamer 0:66f3b5499f7f 39 "source_dir": RTOS_ABSTRACTION,
screamer 0:66f3b5499f7f 40 "build_dir": RTOS_LIBRARIES,
screamer 0:66f3b5499f7f 41 "dependencies": [MBED_LIBRARIES, MBED_RTX],
screamer 0:66f3b5499f7f 42 },
screamer 0:66f3b5499f7f 43
screamer 0:66f3b5499f7f 44 # RPC
screamer 0:66f3b5499f7f 45 {
screamer 0:66f3b5499f7f 46 "id": "rpc",
screamer 0:66f3b5499f7f 47 "source_dir": MBED_RPC,
screamer 0:66f3b5499f7f 48 "build_dir": RPC_LIBRARY,
screamer 0:66f3b5499f7f 49 "dependencies": [MBED_LIBRARIES],
screamer 0:66f3b5499f7f 50 },
screamer 0:66f3b5499f7f 51
screamer 0:66f3b5499f7f 52 # USB Device libraries
screamer 0:66f3b5499f7f 53 {
screamer 0:66f3b5499f7f 54 "id": "usb",
screamer 0:66f3b5499f7f 55 "source_dir": USB,
screamer 0:66f3b5499f7f 56 "build_dir": USB_LIBRARIES,
screamer 0:66f3b5499f7f 57 "dependencies": [MBED_LIBRARIES],
screamer 0:66f3b5499f7f 58 },
screamer 0:66f3b5499f7f 59
screamer 0:66f3b5499f7f 60 # USB Host libraries
screamer 0:66f3b5499f7f 61 {
screamer 0:66f3b5499f7f 62 "id": "usb_host",
screamer 0:66f3b5499f7f 63 "source_dir": USB_HOST,
screamer 0:66f3b5499f7f 64 "build_dir": USB_HOST_LIBRARIES,
screamer 0:66f3b5499f7f 65 "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],
screamer 0:66f3b5499f7f 66 },
screamer 0:66f3b5499f7f 67
screamer 0:66f3b5499f7f 68 # DSP libraries
screamer 0:66f3b5499f7f 69 {
screamer 13:ab47a20b66f0 70 "id": "dsp",
screamer 13:ab47a20b66f0 71 "source_dir": [DSP_ABSTRACTION, DSP_CMSIS],
screamer 0:66f3b5499f7f 72 "build_dir": DSP_LIBRARIES,
screamer 13:ab47a20b66f0 73 "dependencies": [MBED_LIBRARIES]
screamer 0:66f3b5499f7f 74 },
screamer 0:66f3b5499f7f 75
screamer 0:66f3b5499f7f 76 # File system libraries
screamer 0:66f3b5499f7f 77 {
screamer 0:66f3b5499f7f 78 "id": "fat",
screamer 0:66f3b5499f7f 79 "source_dir": [FAT_FS, SD_FS],
screamer 0:66f3b5499f7f 80 "build_dir": FS_LIBRARY,
screamer 0:66f3b5499f7f 81 "dependencies": [MBED_LIBRARIES]
screamer 0:66f3b5499f7f 82 },
screamer 0:66f3b5499f7f 83
screamer 0:66f3b5499f7f 84 # Network libraries
screamer 0:66f3b5499f7f 85 {
screamer 0:66f3b5499f7f 86 "id": "eth",
screamer 0:66f3b5499f7f 87 "source_dir": [ETH_SOURCES, LWIP_SOURCES],
screamer 0:66f3b5499f7f 88 "build_dir": ETH_LIBRARY,
screamer 0:66f3b5499f7f 89 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES]
screamer 0:66f3b5499f7f 90 },
screamer 0:66f3b5499f7f 91
screamer 0:66f3b5499f7f 92 {
screamer 0:66f3b5499f7f 93 "id": "ublox",
screamer 29:1210849dba19 94 "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES,
screamer 29:1210849dba19 95 LWIP_SOURCES],
screamer 0:66f3b5499f7f 96 "build_dir": UBLOX_LIBRARY,
screamer 0:66f3b5499f7f 97 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES],
screamer 0:66f3b5499f7f 98 },
screamer 0:66f3b5499f7f 99
screamer 0:66f3b5499f7f 100 # Unit Testing library
screamer 0:66f3b5499f7f 101 {
screamer 0:66f3b5499f7f 102 "id": "cpputest",
screamer 29:1210849dba19 103 "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC,
screamer 29:1210849dba19 104 CPPUTEST_TESTRUNNER_SCR],
screamer 0:66f3b5499f7f 105 "build_dir": CPPUTEST_LIBRARY,
screamer 0:66f3b5499f7f 106 "dependencies": [MBED_LIBRARIES],
screamer 29:1210849dba19 107 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC,
screamer 29:1210849dba19 108 CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB],
screamer 0:66f3b5499f7f 109 'inc_dirs_ext': [CPPUTEST_INC_EXT],
screamer 29:1210849dba19 110 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0",
screamer 29:1210849dba19 111 "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"],
screamer 0:66f3b5499f7f 112 },
screamer 0:66f3b5499f7f 113 ]
screamer 0:66f3b5499f7f 114
screamer 0:66f3b5499f7f 115
screamer 0:66f3b5499f7f 116 LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES])
screamer 0:66f3b5499f7f 117
screamer 0:66f3b5499f7f 118
screamer 29:1210849dba19 119 class Library(object):
screamer 29:1210849dba19 120 """A library representation that allows for querying of support"""
screamer 0:66f3b5499f7f 121 def __init__(self, lib_id):
screamer 29:1210849dba19 122 lib = LIBRARY_MAP[lib_id]
screamer 29:1210849dba19 123 self.supported = lib.get("supported", DEFAULT_SUPPORT)
screamer 29:1210849dba19 124 self.dependencies = lib.get("dependencies", None)
screamer 29:1210849dba19 125 # Include dirs required by library build
screamer 29:1210849dba19 126 self.inc_dirs = lib.get("inc_dirs", None)
screamer 29:1210849dba19 127 # Include dirs required by others to use with this library
screamer 29:1210849dba19 128 self.inc_dirs_ext = lib.get("inc_dirs_ext", None)
screamer 29:1210849dba19 129 # Additional macros you want to define when building library
screamer 29:1210849dba19 130 self.macros = lib.get("macros", None)
screamer 29:1210849dba19 131
screamer 29:1210849dba19 132 self.source_dir = lib["source_dir"]
screamer 29:1210849dba19 133 self.build_dir = lib["build_dir"]
screamer 0:66f3b5499f7f 134
screamer 0:66f3b5499f7f 135 def is_supported(self, target, toolchain):
screamer 29:1210849dba19 136 """Check if a target toolchain combination is supported
screamer 29:1210849dba19 137
screamer 29:1210849dba19 138 Positional arguments:
screamer 29:1210849dba19 139 target - the MCU or board
screamer 29:1210849dba19 140 toolchain - the compiler
screamer 29:1210849dba19 141 """
screamer 0:66f3b5499f7f 142 if not hasattr(self, 'supported'):
screamer 0:66f3b5499f7f 143 return True
screamer 29:1210849dba19 144 return (target.name in self.supported) and \
screamer 29:1210849dba19 145 (toolchain in self.supported[target.name])