Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
tools/libraries.py@3:1198227e6421, 2016-12-16 (annotated)
- Committer:
- switches
- Date:
- Fri Dec 16 16:27:57 2016 +0000
- Revision:
- 3:1198227e6421
- Parent:
- 0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:5c4d7b2438d3 | 1 | """ |
switches | 0:5c4d7b2438d3 | 2 | mbed SDK |
switches | 0:5c4d7b2438d3 | 3 | Copyright (c) 2011-2013 ARM Limited |
switches | 0:5c4d7b2438d3 | 4 | |
switches | 0:5c4d7b2438d3 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
switches | 0:5c4d7b2438d3 | 6 | you may not use this file except in compliance with the License. |
switches | 0:5c4d7b2438d3 | 7 | You may obtain a copy of the License at |
switches | 0:5c4d7b2438d3 | 8 | |
switches | 0:5c4d7b2438d3 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
switches | 0:5c4d7b2438d3 | 10 | |
switches | 0:5c4d7b2438d3 | 11 | Unless required by applicable law or agreed to in writing, software |
switches | 0:5c4d7b2438d3 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
switches | 0:5c4d7b2438d3 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
switches | 0:5c4d7b2438d3 | 14 | See the License for the specific language governing permissions and |
switches | 0:5c4d7b2438d3 | 15 | limitations under the License. |
switches | 0:5c4d7b2438d3 | 16 | """ |
switches | 0:5c4d7b2438d3 | 17 | from tools.paths import MBED_RTX, RTOS, RTOS_LIBRARIES, MBED_LIBRARIES,\ |
switches | 0:5c4d7b2438d3 | 18 | MBED_RPC, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\ |
switches | 0:5c4d7b2438d3 | 19 | USB_HOST_LIBRARIES, FAT_FS, DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\ |
switches | 0:5c4d7b2438d3 | 20 | SD_FS, FS_LIBRARY, ETH_SOURCES, LWIP_SOURCES, ETH_LIBRARY, UBLOX_SOURCES,\ |
switches | 0:5c4d7b2438d3 | 21 | UBLOX_LIBRARY, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, CPPUTEST_SRC,\ |
switches | 0:5c4d7b2438d3 | 22 | CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR, CPPUTEST_LIBRARY,\ |
switches | 0:5c4d7b2438d3 | 23 | CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC,\ |
switches | 0:5c4d7b2438d3 | 24 | CPPUTEST_INC_EXT |
switches | 0:5c4d7b2438d3 | 25 | from tools.data.support import DEFAULT_SUPPORT |
switches | 0:5c4d7b2438d3 | 26 | from tools.tests import TEST_MBED_LIB |
switches | 0:5c4d7b2438d3 | 27 | |
switches | 0:5c4d7b2438d3 | 28 | |
switches | 0:5c4d7b2438d3 | 29 | LIBRARIES = [ |
switches | 0:5c4d7b2438d3 | 30 | # RTOS libraries |
switches | 0:5c4d7b2438d3 | 31 | { |
switches | 0:5c4d7b2438d3 | 32 | "id": "rtx", |
switches | 0:5c4d7b2438d3 | 33 | "source_dir": MBED_RTX, |
switches | 0:5c4d7b2438d3 | 34 | "build_dir": RTOS_LIBRARIES, |
switches | 0:5c4d7b2438d3 | 35 | "dependencies": [MBED_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 36 | }, |
switches | 0:5c4d7b2438d3 | 37 | { |
switches | 0:5c4d7b2438d3 | 38 | "id": "rtos", |
switches | 0:5c4d7b2438d3 | 39 | "source_dir": RTOS, |
switches | 0:5c4d7b2438d3 | 40 | "build_dir": RTOS_LIBRARIES, |
switches | 0:5c4d7b2438d3 | 41 | "dependencies": [MBED_LIBRARIES, MBED_RTX], |
switches | 0:5c4d7b2438d3 | 42 | }, |
switches | 0:5c4d7b2438d3 | 43 | |
switches | 0:5c4d7b2438d3 | 44 | # RPC |
switches | 0:5c4d7b2438d3 | 45 | { |
switches | 0:5c4d7b2438d3 | 46 | "id": "rpc", |
switches | 0:5c4d7b2438d3 | 47 | "source_dir": MBED_RPC, |
switches | 0:5c4d7b2438d3 | 48 | "build_dir": RPC_LIBRARY, |
switches | 0:5c4d7b2438d3 | 49 | "dependencies": [MBED_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 50 | }, |
switches | 0:5c4d7b2438d3 | 51 | |
switches | 0:5c4d7b2438d3 | 52 | # USB Device libraries |
switches | 0:5c4d7b2438d3 | 53 | { |
switches | 0:5c4d7b2438d3 | 54 | "id": "usb", |
switches | 0:5c4d7b2438d3 | 55 | "source_dir": USB, |
switches | 0:5c4d7b2438d3 | 56 | "build_dir": USB_LIBRARIES, |
switches | 0:5c4d7b2438d3 | 57 | "dependencies": [MBED_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 58 | }, |
switches | 0:5c4d7b2438d3 | 59 | |
switches | 0:5c4d7b2438d3 | 60 | # USB Host libraries |
switches | 0:5c4d7b2438d3 | 61 | { |
switches | 0:5c4d7b2438d3 | 62 | "id": "usb_host", |
switches | 0:5c4d7b2438d3 | 63 | "source_dir": USB_HOST, |
switches | 0:5c4d7b2438d3 | 64 | "build_dir": USB_HOST_LIBRARIES, |
switches | 0:5c4d7b2438d3 | 65 | "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 66 | }, |
switches | 0:5c4d7b2438d3 | 67 | |
switches | 0:5c4d7b2438d3 | 68 | # DSP libraries |
switches | 0:5c4d7b2438d3 | 69 | { |
switches | 0:5c4d7b2438d3 | 70 | "id": "dsp", |
switches | 0:5c4d7b2438d3 | 71 | "source_dir": [DSP_ABSTRACTION, DSP_CMSIS], |
switches | 0:5c4d7b2438d3 | 72 | "build_dir": DSP_LIBRARIES, |
switches | 0:5c4d7b2438d3 | 73 | "dependencies": [MBED_LIBRARIES] |
switches | 0:5c4d7b2438d3 | 74 | }, |
switches | 0:5c4d7b2438d3 | 75 | |
switches | 0:5c4d7b2438d3 | 76 | # File system libraries |
switches | 0:5c4d7b2438d3 | 77 | { |
switches | 0:5c4d7b2438d3 | 78 | "id": "fat", |
switches | 0:5c4d7b2438d3 | 79 | "source_dir": [FAT_FS, SD_FS], |
switches | 0:5c4d7b2438d3 | 80 | "build_dir": FS_LIBRARY, |
switches | 0:5c4d7b2438d3 | 81 | "dependencies": [MBED_LIBRARIES] |
switches | 0:5c4d7b2438d3 | 82 | }, |
switches | 0:5c4d7b2438d3 | 83 | |
switches | 0:5c4d7b2438d3 | 84 | # Network libraries |
switches | 0:5c4d7b2438d3 | 85 | { |
switches | 0:5c4d7b2438d3 | 86 | "id": "eth", |
switches | 0:5c4d7b2438d3 | 87 | "source_dir": [ETH_SOURCES, LWIP_SOURCES], |
switches | 0:5c4d7b2438d3 | 88 | "build_dir": ETH_LIBRARY, |
switches | 0:5c4d7b2438d3 | 89 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES] |
switches | 0:5c4d7b2438d3 | 90 | }, |
switches | 0:5c4d7b2438d3 | 91 | |
switches | 0:5c4d7b2438d3 | 92 | { |
switches | 0:5c4d7b2438d3 | 93 | "id": "ublox", |
switches | 0:5c4d7b2438d3 | 94 | "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, |
switches | 0:5c4d7b2438d3 | 95 | LWIP_SOURCES], |
switches | 0:5c4d7b2438d3 | 96 | "build_dir": UBLOX_LIBRARY, |
switches | 0:5c4d7b2438d3 | 97 | "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 98 | }, |
switches | 0:5c4d7b2438d3 | 99 | |
switches | 0:5c4d7b2438d3 | 100 | # Unit Testing library |
switches | 0:5c4d7b2438d3 | 101 | { |
switches | 0:5c4d7b2438d3 | 102 | "id": "cpputest", |
switches | 0:5c4d7b2438d3 | 103 | "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, |
switches | 0:5c4d7b2438d3 | 104 | CPPUTEST_TESTRUNNER_SCR], |
switches | 0:5c4d7b2438d3 | 105 | "build_dir": CPPUTEST_LIBRARY, |
switches | 0:5c4d7b2438d3 | 106 | "dependencies": [MBED_LIBRARIES], |
switches | 0:5c4d7b2438d3 | 107 | 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, |
switches | 0:5c4d7b2438d3 | 108 | CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB], |
switches | 0:5c4d7b2438d3 | 109 | 'inc_dirs_ext': [CPPUTEST_INC_EXT], |
switches | 0:5c4d7b2438d3 | 110 | 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", |
switches | 0:5c4d7b2438d3 | 111 | "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"], |
switches | 0:5c4d7b2438d3 | 112 | }, |
switches | 0:5c4d7b2438d3 | 113 | ] |
switches | 0:5c4d7b2438d3 | 114 | |
switches | 0:5c4d7b2438d3 | 115 | |
switches | 0:5c4d7b2438d3 | 116 | LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES]) |
switches | 0:5c4d7b2438d3 | 117 | |
switches | 0:5c4d7b2438d3 | 118 | |
switches | 0:5c4d7b2438d3 | 119 | class Library(object): |
switches | 0:5c4d7b2438d3 | 120 | """A library representation that allows for querying of support""" |
switches | 0:5c4d7b2438d3 | 121 | def __init__(self, lib_id): |
switches | 0:5c4d7b2438d3 | 122 | lib = LIBRARY_MAP[lib_id] |
switches | 0:5c4d7b2438d3 | 123 | self.supported = lib.get("supported", DEFAULT_SUPPORT) |
switches | 0:5c4d7b2438d3 | 124 | self.dependencies = lib.get("dependencies", None) |
switches | 0:5c4d7b2438d3 | 125 | # Include dirs required by library build |
switches | 0:5c4d7b2438d3 | 126 | self.inc_dirs = lib.get("inc_dirs", None) |
switches | 0:5c4d7b2438d3 | 127 | # Include dirs required by others to use with this library |
switches | 0:5c4d7b2438d3 | 128 | self.inc_dirs_ext = lib.get("inc_dirs_ext", None) |
switches | 0:5c4d7b2438d3 | 129 | # Additional macros you want to define when building library |
switches | 0:5c4d7b2438d3 | 130 | self.macros = lib.get("macros", None) |
switches | 0:5c4d7b2438d3 | 131 | |
switches | 0:5c4d7b2438d3 | 132 | self.source_dir = lib["source_dir"] |
switches | 0:5c4d7b2438d3 | 133 | self.build_dir = lib["build_dir"] |
switches | 0:5c4d7b2438d3 | 134 | |
switches | 0:5c4d7b2438d3 | 135 | def is_supported(self, target, toolchain): |
switches | 0:5c4d7b2438d3 | 136 | """Check if a target toolchain combination is supported |
switches | 0:5c4d7b2438d3 | 137 | |
switches | 0:5c4d7b2438d3 | 138 | Positional arguments: |
switches | 0:5c4d7b2438d3 | 139 | target - the MCU or board |
switches | 0:5c4d7b2438d3 | 140 | toolchain - the compiler |
switches | 0:5c4d7b2438d3 | 141 | """ |
switches | 0:5c4d7b2438d3 | 142 | if not hasattr(self, 'supported'): |
switches | 0:5c4d7b2438d3 | 143 | return True |
switches | 0:5c4d7b2438d3 | 144 | return (target.name in self.supported) and \ |
switches | 0:5c4d7b2438d3 | 145 | (toolchain in self.supported[target.name]) |