mbed-os
Fork of mbed-os by
tools/build_travis.py@1:3deb71413561, 2017-07-20 (annotated)
- Committer:
- xuaner
- Date:
- Thu Jul 20 14:26:57 2017 +0000
- Revision:
- 1:3deb71413561
- Parent:
- 0:f269e3021894
mbed_os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #!/usr/bin/env python2 |
elessair | 0:f269e3021894 | 2 | |
elessair | 0:f269e3021894 | 3 | """ |
elessair | 0:f269e3021894 | 4 | Travis-CI build script |
elessair | 0:f269e3021894 | 5 | |
elessair | 0:f269e3021894 | 6 | mbed SDK |
elessair | 0:f269e3021894 | 7 | Copyright (c) 2011-2013 ARM Limited |
elessair | 0:f269e3021894 | 8 | |
elessair | 0:f269e3021894 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); |
elessair | 0:f269e3021894 | 10 | you may not use this file except in compliance with the License. |
elessair | 0:f269e3021894 | 11 | You may obtain a copy of the License at |
elessair | 0:f269e3021894 | 12 | |
elessair | 0:f269e3021894 | 13 | http://www.apache.org/licenses/LICENSE-2.0 |
elessair | 0:f269e3021894 | 14 | |
elessair | 0:f269e3021894 | 15 | Unless required by applicable law or agreed to in writing, software |
elessair | 0:f269e3021894 | 16 | distributed under the License is distributed on an "AS IS" BASIS, |
elessair | 0:f269e3021894 | 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
elessair | 0:f269e3021894 | 18 | See the License for the specific language governing permissions and |
elessair | 0:f269e3021894 | 19 | limitations under the License. |
elessair | 0:f269e3021894 | 20 | """ |
elessair | 0:f269e3021894 | 21 | |
elessair | 0:f269e3021894 | 22 | import os |
elessair | 0:f269e3021894 | 23 | import sys |
elessair | 0:f269e3021894 | 24 | |
elessair | 0:f269e3021894 | 25 | ################################################################################ |
elessair | 0:f269e3021894 | 26 | # Configure builds here |
elessair | 0:f269e3021894 | 27 | # "libs" can contain "dsp", "rtos", "eth", "usb_host", "usb", "ublox", "fat" |
elessair | 0:f269e3021894 | 28 | |
elessair | 0:f269e3021894 | 29 | build_list = ( |
elessair | 0:f269e3021894 | 30 | { "target": "LPC1768", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "eth", "usb_host", "usb", "ublox", "fat"] }, |
elessair | 0:f269e3021894 | 31 | { "target": "LPC2368", "toolchains": "GCC_ARM", "libs": ["fat"] }, |
elessair | 0:f269e3021894 | 32 | { "target": "LPC2460", "toolchains": "GCC_ARM", "libs": ["rtos", "usb_host", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 33 | { "target": "LPC11U24", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 34 | { "target": "OC_MBUINO", "toolchains": "GCC_ARM", "libs": ["fat"] }, |
elessair | 0:f269e3021894 | 35 | |
elessair | 0:f269e3021894 | 36 | { "target": "LPC11U24_301", "toolchains": "GCC_ARM", "libs": ["fat"] }, |
elessair | 0:f269e3021894 | 37 | |
elessair | 0:f269e3021894 | 38 | { "target": "B96B_F446VE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 39 | { "target": "NUCLEO_L053R8", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 40 | { "target": "NUCLEO_L152RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 41 | { "target": "NUCLEO_F030R8", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 42 | { "target": "NUCLEO_F031K6", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 43 | { "target": "NUCLEO_F042K6", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 44 | { "target": "NUCLEO_F070RB", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 45 | { "target": "NUCLEO_F072RB", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 46 | { "target": "NUCLEO_F091RC", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 47 | { "target": "NUCLEO_F103RB", "toolchains": "GCC_ARM", "libs": ["rtos", "fat"] }, |
elessair | 0:f269e3021894 | 48 | { "target": "NUCLEO_F207ZG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 49 | { "target": "NUCLEO_F302R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 50 | { "target": "NUCLEO_F303K8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 51 | { "target": "NUCLEO_F303RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 52 | { "target": "NUCLEO_F303ZE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 53 | { "target": "NUCLEO_F334R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 54 | { "target": "NUCLEO_F401RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 55 | { "target": "NUCLEO_F410RB", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 56 | { "target": "NUCLEO_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 57 | { "target": "NUCLEO_L432KC", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 58 | { "target": "NUCLEO_L476RG", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 59 | { "target": "NUCLEO_L011K4", "toolchains": "GCC_ARM", "libs": ["dsp"] }, |
elessair | 0:f269e3021894 | 60 | { "target": "NUCLEO_L031K6", "toolchains": "GCC_ARM", "libs": ["dsp"] }, |
elessair | 0:f269e3021894 | 61 | { "target": "NUCLEO_L073RZ", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 62 | { "target": "NUCLEO_F429ZI", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 63 | { "target": "NUCLEO_F446RE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 64 | { "target": "NUCLEO_F446ZE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 65 | { "target": "NUCLEO_F746ZG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 66 | { "target": "NUCLEO_F767ZI", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 67 | |
elessair | 0:f269e3021894 | 68 | { "target": "MOTE_L152RC", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 69 | |
elessair | 0:f269e3021894 | 70 | { "target": "ELMO_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 71 | |
elessair | 0:f269e3021894 | 72 | { "target": "MTS_MDOT_F405RG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] }, |
elessair | 0:f269e3021894 | 73 | { "target": "MTS_MDOT_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] }, |
elessair | 0:f269e3021894 | 74 | { "target": "MTS_DRAGONFLY_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 75 | { "target": "ARCH_MAX", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 76 | |
elessair | 0:f269e3021894 | 77 | { "target": "DISCO_F051R8", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 78 | { "target": "DISCO_F334C8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 79 | { "target": "DISCO_F401VC", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 80 | { "target": "DISCO_F407VG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 81 | { "target": "DISCO_F429ZI", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 82 | { "target": "DISCO_F469NI", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 83 | { "target": "DISCO_F746NG", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 84 | { "target": "DISCO_F769NI", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 85 | |
elessair | 0:f269e3021894 | 86 | { "target": "LPC1114", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 87 | { "target": "LPC11U35_401", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 88 | { "target": "UBLOX_C027", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 89 | { "target": "LPC11U35_501", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 90 | { "target": "LPC11U68", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 91 | { "target": "LPC11U37H_401", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 92 | |
elessair | 0:f269e3021894 | 93 | { "target": "KL05Z", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 94 | { "target": "KL25Z", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 95 | { "target": "KL27Z", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 96 | { "target": "KL43Z", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 97 | { "target": "KL46Z", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 98 | { "target": "K20D50M", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 99 | { "target": "TEENSY3_1", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 100 | { "target": "K64F", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 101 | { "target": "LPC4088", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] }, |
elessair | 0:f269e3021894 | 102 | { "target": "ARCH_PRO", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 103 | { "target": "LPC1549", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 104 | { "target": "NRF51822", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 105 | { "target": "DELTA_DFCM_NNN40", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 106 | { "target": "NRF51_DK", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 107 | { "target": "NRF51_MICROBIT", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, |
elessair | 0:f269e3021894 | 108 | |
elessair | 0:f269e3021894 | 109 | { "target": "EFM32ZG_STK3200", "toolchains": "GCC_ARM", "libs": ["dsp"] }, |
elessair | 0:f269e3021894 | 110 | { "target": "EFM32HG_STK3400", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb"] }, |
elessair | 0:f269e3021894 | 111 | { "target": "EFM32LG_STK3600", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb"] }, |
elessair | 0:f269e3021894 | 112 | { "target": "EFM32GG_STK3700", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb"] }, |
elessair | 0:f269e3021894 | 113 | { "target": "EFM32WG_STK3800", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb"] }, |
elessair | 0:f269e3021894 | 114 | { "target": "EFM32PG_STK3401", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] }, |
elessair | 0:f269e3021894 | 115 | |
elessair | 0:f269e3021894 | 116 | { "target": "MAXWSNENV", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 117 | { "target": "MAX32600MBED", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 118 | { "target": "MAX32620HSP", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 119 | |
elessair | 0:f269e3021894 | 120 | { "target": "RZ_A1H", "toolchains": "GCC_ARM", "libs": ["fat"] }, |
elessair | 0:f269e3021894 | 121 | |
elessair | 0:f269e3021894 | 122 | { "target": "SAMR21G18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 123 | { "target": "SAMD21J18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 124 | { "target": "SAMD21G18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 125 | { "target": "SAML21J18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, |
elessair | 0:f269e3021894 | 126 | ) |
elessair | 0:f269e3021894 | 127 | |
elessair | 0:f269e3021894 | 128 | ################################################################################ |
elessair | 0:f269e3021894 | 129 | # Configure example test building (linking against external mbed SDK libraries liek fat or rtos) |
elessair | 0:f269e3021894 | 130 | |
elessair | 0:f269e3021894 | 131 | linking_list = [ |
elessair | 0:f269e3021894 | 132 | {"target": "LPC1768", |
elessair | 0:f269e3021894 | 133 | "toolchains": "GCC_ARM", |
elessair | 0:f269e3021894 | 134 | "tests": {"" : ["MBED_2", "MBED_10", "MBED_11", "MBED_15", "MBED_16", "MBED_17"], |
elessair | 0:f269e3021894 | 135 | "eth" : ["NET_1", "NET_2", "NET_3", "NET_4"], |
elessair | 0:f269e3021894 | 136 | "fat" : ["MBED_A12", "MBED_19", "PERF_1", "PERF_2", "PERF_3"], |
elessair | 0:f269e3021894 | 137 | "rtos" : ["RTOS_1", "RTOS_2", "RTOS_3"], |
elessair | 0:f269e3021894 | 138 | "usb" : ["USB_1", "USB_2" ,"USB_3"], |
elessair | 0:f269e3021894 | 139 | } |
elessair | 0:f269e3021894 | 140 | } |
elessair | 0:f269e3021894 | 141 | ] |
elessair | 0:f269e3021894 | 142 | |
elessair | 0:f269e3021894 | 143 | ################################################################################ |
elessair | 0:f269e3021894 | 144 | |
elessair | 0:f269e3021894 | 145 | # Driver |
elessair | 0:f269e3021894 | 146 | |
elessair | 0:f269e3021894 | 147 | def run_builds(dry_run): |
elessair | 0:f269e3021894 | 148 | for build in build_list: |
elessair | 0:f269e3021894 | 149 | toolchain_list = build["toolchains"] |
elessair | 0:f269e3021894 | 150 | if type(toolchain_list) != type([]): toolchain_list = [toolchain_list] |
elessair | 0:f269e3021894 | 151 | for toolchain in toolchain_list: |
elessair | 0:f269e3021894 | 152 | cmdline = "python tools/build.py -m %s -t %s -j 4 -c --silent "% (build["target"], toolchain) |
elessair | 0:f269e3021894 | 153 | libs = build.get("libs", []) |
elessair | 0:f269e3021894 | 154 | if libs: |
elessair | 0:f269e3021894 | 155 | cmdline = cmdline + " ".join(["--" + l for l in libs]) |
elessair | 0:f269e3021894 | 156 | print "Executing: " + cmdline |
elessair | 0:f269e3021894 | 157 | if not dry_run: |
elessair | 0:f269e3021894 | 158 | if os.system(cmdline) != 0: |
elessair | 0:f269e3021894 | 159 | sys.exit(1) |
elessair | 0:f269e3021894 | 160 | |
elessair | 0:f269e3021894 | 161 | |
elessair | 0:f269e3021894 | 162 | def run_test_linking(dry_run): |
elessair | 0:f269e3021894 | 163 | """ Function run make.py commands to build and link simple mbed SDK |
elessair | 0:f269e3021894 | 164 | tests against few libraries to make sure there are no simple linking errors. |
elessair | 0:f269e3021894 | 165 | """ |
elessair | 0:f269e3021894 | 166 | for link in linking_list: |
elessair | 0:f269e3021894 | 167 | toolchain_list = link["toolchains"] |
elessair | 0:f269e3021894 | 168 | if type(toolchain_list) != type([]): |
elessair | 0:f269e3021894 | 169 | toolchain_list = [toolchain_list] |
elessair | 0:f269e3021894 | 170 | for toolchain in toolchain_list: |
elessair | 0:f269e3021894 | 171 | tests = link["tests"] |
elessair | 0:f269e3021894 | 172 | # Call make.py for each test group for particular library |
elessair | 0:f269e3021894 | 173 | for test_lib in tests: |
elessair | 0:f269e3021894 | 174 | test_names = tests[test_lib] |
elessair | 0:f269e3021894 | 175 | test_lib_switch = "--" + test_lib if test_lib else "" |
elessair | 0:f269e3021894 | 176 | cmdline = "python tools/make.py -m %s -t %s -c --silent %s -n %s " % (link["target"], toolchain, test_lib_switch, ",".join(test_names)) |
elessair | 0:f269e3021894 | 177 | print "Executing: " + cmdline |
elessair | 0:f269e3021894 | 178 | if not dry_run: |
elessair | 0:f269e3021894 | 179 | if os.system(cmdline) != 0: |
elessair | 0:f269e3021894 | 180 | sys.exit(1) |
elessair | 0:f269e3021894 | 181 | |
elessair | 0:f269e3021894 | 182 | def run_test_testsuite(dry_run): |
elessair | 0:f269e3021894 | 183 | cmdline = "python tools/singletest.py --version" |
elessair | 0:f269e3021894 | 184 | print "Executing: " + cmdline |
elessair | 0:f269e3021894 | 185 | if not dry_run: |
elessair | 0:f269e3021894 | 186 | if os.system(cmdline) != 0: |
elessair | 0:f269e3021894 | 187 | sys.exit(1) |
elessair | 0:f269e3021894 | 188 | |
elessair | 0:f269e3021894 | 189 | if __name__ == "__main__": |
elessair | 0:f269e3021894 | 190 | run_builds("-s" in sys.argv) |
elessair | 0:f269e3021894 | 191 | run_test_linking("-s" in sys.argv) |
elessair | 0:f269e3021894 | 192 | run_test_testsuite("-s" in sys.argv) |