upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

build_release.py 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. """
  2. mbed SDK
  3. Copyright (c) 2011-2013 ARM Limited
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. """
  14. import sys
  15. from time import time
  16. from os.path import join, abspath, dirname
  17. from optparse import OptionParser
  18. # Be sure that the tools directory is in the search path
  19. ROOT = abspath(join(dirname(__file__), ".."))
  20. sys.path.insert(0, ROOT)
  21. from workspace_tools.build_api import build_mbed_libs
  22. from workspace_tools.build_api import write_build_report
  23. from workspace_tools.targets import TARGET_MAP
  24. OFFICIAL_MBED_LIBRARY_BUILD = (
  25. ('LPC11U24', ('ARM', 'uARM', 'GCC_ARM', 'IAR')),
  26. ('LPC1768', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')),
  27. ('UBLOX_C027', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')),
  28. ('ARCH_PRO', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')),
  29. ('LPC2368', ('ARM', 'GCC_ARM')),
  30. ('LPC812', ('uARM','IAR')),
  31. ('LPC824', ('uARM', 'GCC_ARM', 'IAR', 'GCC_CR')),
  32. ('SSCI824', ('uARM','GCC_ARM')),
  33. ('LPC1347', ('ARM','IAR')),
  34. ('LPC4088', ('ARM', 'GCC_ARM', 'GCC_CR', 'IAR')),
  35. ('LPC4088_DM', ('ARM', 'GCC_ARM', 'GCC_CR', 'IAR')),
  36. ('LPC1114', ('uARM','GCC_ARM', 'GCC_CR', 'IAR')),
  37. ('LPC11U35_401', ('ARM', 'uARM','GCC_ARM','GCC_CR', 'IAR')),
  38. ('LPC11U35_501', ('ARM', 'uARM','GCC_ARM','GCC_CR', 'IAR')),
  39. ('LPC1549', ('uARM','GCC_ARM','GCC_CR', 'IAR')),
  40. ('XADOW_M0', ('ARM', 'uARM','GCC_ARM','GCC_CR')),
  41. ('ARCH_GPRS', ('ARM', 'uARM', 'GCC_ARM', 'GCC_CR', 'IAR')),
  42. ('LPC4337', ('ARM',)),
  43. ('LPC11U37H_401', ('ARM', 'uARM','GCC_ARM','GCC_CR', 'IAR')),
  44. ('KL05Z', ('ARM', 'uARM', 'GCC_ARM', 'IAR')),
  45. ('KL25Z', ('ARM', 'GCC_ARM', 'IAR')),
  46. ('KL43Z', ('ARM', 'GCC_ARM')),
  47. ('KL46Z', ('ARM', 'GCC_ARM', 'IAR')),
  48. ('K64F', ('ARM', 'GCC_ARM', 'IAR')),
  49. ('K22F', ('ARM', 'GCC_ARM', 'IAR')),
  50. ('K20D50M', ('ARM', 'GCC_ARM' , 'IAR')),
  51. ('TEENSY3_1', ('ARM', 'GCC_ARM')),
  52. ('NUCLEO_F030R8', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  53. ('NUCLEO_F070RB', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  54. ('NUCLEO_F072RB', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  55. ('NUCLEO_F091RC', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  56. ('NUCLEO_F103RB', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  57. ('NUCLEO_F302R8', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  58. ('NUCLEO_F303RE', ('ARM', 'uARM', 'IAR')),
  59. ('NUCLEO_F334R8', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  60. ('NUCLEO_F401RE', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  61. ('NUCLEO_F411RE', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  62. ('NUCLEO_L053R8', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  63. ('NUCLEO_L152RE', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  64. ('MTS_MDOT_F405RG', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  65. ('MTS_MDOT_F411RE', ('ARM', 'uARM', 'IAR', 'GCC_ARM')),
  66. ('ARCH_MAX', ('ARM', 'GCC_ARM')),
  67. ('NRF51822', ('ARM', 'GCC_ARM', 'IAR')),
  68. ('NRF51_DK', ('ARM', 'GCC_ARM', 'IAR')),
  69. ('NRF51_DONGLE', ('ARM', 'GCC_ARM', 'IAR')),
  70. ('HRM1017', ('ARM', 'GCC_ARM', 'IAR')),
  71. ('ARCH_BLE', ('ARM', 'GCC_ARM', 'IAR')),
  72. ('SEEED_TINY_BLE', ('ARM', 'GCC_ARM', 'IAR')),
  73. ('RBLAB_NRF51822', ('ARM', 'GCC_ARM')),
  74. ('RBLAB_BLENANO', ('ARM', 'GCC_ARM')),
  75. ('WALLBOT_BLE', ('ARM', 'GCC_ARM')),
  76. ('LPC11U68', ('ARM', 'uARM','GCC_ARM','GCC_CR', 'IAR')),
  77. ('OC_MBUINO', ('ARM', 'uARM', 'GCC_ARM', 'IAR')),
  78. ('RZ_A1H' , ('ARM', 'GCC_ARM')),
  79. )
  80. if __name__ == '__main__':
  81. parser = OptionParser()
  82. parser.add_option('-o', '--official', dest="official_only", default=False, action="store_true",
  83. help="Build using only the official toolchain for each target")
  84. parser.add_option("-j", "--jobs", type="int", dest="jobs",
  85. default=1, help="Number of concurrent jobs (default 1). Use 0 for auto based on host machine's number of CPUs")
  86. parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
  87. default=False, help="Verbose diagnostic output")
  88. parser.add_option("-t", "--toolchains", dest="toolchains", help="Use toolchains names separated by comma")
  89. parser.add_option("", "--report-build", dest="report_build_file_name", help="Output the build results to an html file")
  90. options, args = parser.parse_args()
  91. start = time()
  92. failures = []
  93. successes = []
  94. skips = []
  95. build_report = []
  96. for target_name, toolchain_list in OFFICIAL_MBED_LIBRARY_BUILD:
  97. if options.official_only:
  98. toolchains = (getattr(TARGET_MAP[target_name], 'default_toolchain', 'ARM'),)
  99. else:
  100. toolchains = toolchain_list
  101. if options.toolchains:
  102. print "Only building using the following toolchains: %s" % (options.toolchains)
  103. toolchainSet = set(toolchains)
  104. toolchains = toolchainSet and set((options.toolchains).split(','))
  105. cur_target_build_report = { "target": target_name, "passing": [], "failing": [], "skipped": []}
  106. for toolchain in toolchains:
  107. id = "%s::%s" % (target_name, toolchain)
  108. try:
  109. built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs)
  110. if built_mbed_lib:
  111. successes.append(id)
  112. cur_target_build_report["passing"].append({ "toolchain": toolchain })
  113. else:
  114. skips.append(id)
  115. cur_target_build_report["skipped"].append({ "toolchain": toolchain })
  116. except Exception, e:
  117. failures.append(id)
  118. cur_target_build_report["failing"].append({ "toolchain": toolchain })
  119. print e
  120. if len(toolchains) > 0:
  121. build_report.append(cur_target_build_report)
  122. # Write summary of the builds
  123. if options.report_build_file_name:
  124. write_build_report(build_report, 'library_build/report.html', options.report_build_file_name)
  125. print "\n\nCompleted in: (%.2f)s" % (time() - start)
  126. if successes:
  127. print "\n\nBuild successes:"
  128. print "\n".join([" * %s" % s for s in successes])
  129. if skips:
  130. print "\n\nBuild skips:"
  131. print "\n".join([" * %s" % s for s in skips])
  132. if failures:
  133. print "\n\nBuild failures:"
  134. print "\n".join([" * %s" % f for f in failures])
  135. sys.exit(1)