Keyboard firmwares for Atmel AVR and Cortex-M
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.

export_test.py 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 os.path import join, abspath, dirname, exists
  16. ROOT = abspath(join(dirname(__file__), ".."))
  17. sys.path.insert(0, ROOT)
  18. from shutil import move
  19. from workspace_tools.paths import *
  20. from workspace_tools.utils import mkdir, cmd
  21. from workspace_tools.export import export, setup_user_prj
  22. USR_PRJ_NAME = "usr_prj"
  23. USER_PRJ = join(EXPORT_WORKSPACE, USR_PRJ_NAME)
  24. USER_SRC = join(USER_PRJ, "src")
  25. def setup_test_user_prj():
  26. if exists(USER_PRJ):
  27. print 'Test user project already generated...'
  28. return
  29. setup_user_prj(USER_PRJ, join(TEST_DIR, "rtos", "mbed", "basic"), [join(LIB_DIR, "rtos")])
  30. # FAKE BUILD URL
  31. open(join(USER_SRC, "mbed.bld"), 'w').write("http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5\n")
  32. def fake_build_url_resolver(url):
  33. # FAKE BUILD URL: Ignore the URL, always return the path to the mbed library
  34. return {'path':MBED_LIBRARIES, 'name':'mbed'}
  35. def test_export(toolchain, target, expected_error=None):
  36. if toolchain is None and target is None:
  37. base_dir = join(EXPORT_TMP, "zip")
  38. else:
  39. base_dir = join(EXPORT_TMP, toolchain, target)
  40. temp_dir = join(base_dir, "temp")
  41. mkdir(temp_dir)
  42. zip_path, report = export(USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, None, fake_build_url_resolver)
  43. if report['success']:
  44. move(zip_path, join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target)))
  45. print "[OK]"
  46. else:
  47. if expected_error is None:
  48. print '[ERRROR] %s' % report['errormsg']
  49. else:
  50. if (zip_path is None) and (expected_error in report['errormsg']):
  51. print '[OK]'
  52. else:
  53. print '[ERROR]'
  54. print ' zip:', zip_path
  55. print ' msg:', report['errormsg']
  56. if __name__ == '__main__':
  57. setup_test_user_prj()
  58. for toolchain, target in [
  59. ('zip', 'LPC1768'),
  60. ('emblocks', 'LPC1768'),
  61. ('emblocks', 'LPC1549'),
  62. ('emblocks', 'LPC1114'),
  63. ('emblocks', 'LPC11U35_401'),
  64. ('emblocks', 'LPC11U35_501'),
  65. ('emblocks', 'LPCCAPPUCCINO'),
  66. ('emblocks', 'LPC2368'),
  67. ('emblocks', 'STM32F407'),
  68. ('emblocks', 'DISCO_F100RB'),
  69. ('emblocks', 'DISCO_F051R8'),
  70. ('emblocks', 'DISCO_F407VG'),
  71. ('emblocks', 'DISCO_F303VC'),
  72. ('emblocks', 'NRF51822'),
  73. ('emblocks', 'NUCLEO_F401RE'),
  74. ('emblocks', 'NUCLEO_F411RE'),
  75. ('emblocks', 'MTS_MDOT_F405RG'),
  76. ('emblocks', 'MTS_MDOT_F411RE'),
  77. ('coide', 'KL05Z'),
  78. ('coide', 'KL25Z'),
  79. ('coide', 'LPC1768'),
  80. ('coide', 'ARCH_PRO'),
  81. ('coide', 'DISCO_F407VG'),
  82. ('coide', 'NUCLEO_F401RE'),
  83. ('coide', 'NUCLEO_F411RE'),
  84. ('coide', 'DISCO_F429ZI'),
  85. ('coide', 'NUCLEO_F334R8'),
  86. ('coide', 'MTS_MDOT_F405RG'),
  87. ('coide', 'MTS_MDOT_F411RE'),
  88. ('uvision', 'LPC1768'),
  89. ('uvision', 'LPC11U24'),
  90. ('uvision', 'KL25Z'),
  91. ('uvision', 'LPC1347'),
  92. ('uvision', 'LPC1114'),
  93. ('uvision', 'LPC4088'),
  94. ('uvision', 'LPC4088_DM'),
  95. ('uvision', 'LPC4337'),
  96. ('uvision', 'HRM1017'),
  97. ('uvision', 'NUCLEO_F030R8'),
  98. ('uvision', 'NUCLEO_F070RB'),
  99. ('uvision', 'NUCLEO_F072RB'),
  100. ('uvision', 'NUCLEO_F091RC'),
  101. ('uvision', 'NUCLEO_F103RB'),
  102. ('uvision', 'NUCLEO_F302R8'),
  103. ('uvision', 'NUCLEO_F303RE'),
  104. ('uvision', 'NUCLEO_F334R8'),
  105. ('uvision', 'NUCLEO_F401RE'),
  106. ('uvision', 'NUCLEO_F411RE'),
  107. ('uvision', 'NUCLEO_L053R8'),
  108. ('uvision', 'NUCLEO_L073RZ'),
  109. ('uvision', 'NUCLEO_L152RE'),
  110. ('uvision', 'MTS_MDOT_F405RG'),
  111. ('uvision', 'MAXWSNENV'),
  112. ('uvision', 'MAX32600MBED'),
  113. ('lpcxpresso', 'LPC1768'),
  114. ('lpcxpresso', 'LPC4088'),
  115. ('lpcxpresso', 'LPC4088_DM'),
  116. ('lpcxpresso', 'LPC1114'),
  117. ('lpcxpresso', 'LPC11U35_401'),
  118. ('lpcxpresso', 'LPC11U35_501'),
  119. ('lpcxpresso', 'LPCCAPPUCCINO'),
  120. ('lpcxpresso', 'LPC1549'),
  121. ('lpcxpresso', 'LPC11U68'),
  122. # Linux path: /home/emimon01/bin/gcc-cs/bin/
  123. # Windows path: "C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/"
  124. ('codesourcery', 'LPC1768'),
  125. # Linux path: /home/emimon01/bin/gcc-arm/bin/
  126. # Windows path: C:/arm-none-eabi-gcc-4_7/bin/
  127. ('gcc_arm', 'LPC1768'),
  128. ('gcc_arm', 'LPC4088_DM'),
  129. ('gcc_arm', 'LPC1549'),
  130. ('gcc_arm', 'LPC1114'),
  131. ('gcc_arm', 'LPC11U35_401'),
  132. ('gcc_arm', 'LPC11U35_501'),
  133. ('gcc_arm', 'LPCCAPPUCCINO'),
  134. ('gcc_arm', 'LPC2368'),
  135. ('gcc_arm', 'LPC824'),
  136. ('gcc_arm', 'SSCI824'),
  137. ('gcc_arm', 'STM32F407'),
  138. ('gcc_arm', 'DISCO_F100RB'),
  139. ('gcc_arm', 'DISCO_F051R8'),
  140. ('gcc_arm', 'DISCO_F407VG'),
  141. ('gcc_arm', 'DISCO_F303VC'),
  142. ('gcc_arm', 'NRF51822'),
  143. ('gcc_arm', 'HRM1017'),
  144. ('gcc_arm', 'NUCLEO_F401RE'),
  145. ('gcc_arm', 'NUCLEO_F411RE'),
  146. ('gcc_arm', 'DISCO_F429ZI'),
  147. ('gcc_arm', 'NUCLEO_F334R8'),
  148. ('gcc_arm', 'MAX32600MBED'),
  149. ('gcc_arm', 'MTS_MDOT_F405RG'),
  150. ('gcc_arm', 'MTS_MDOT_F411RE'),
  151. ('gcc_arm', 'RZ_A1H'),
  152. ('gcc_arm', 'MAXWSNENV'),
  153. ('gcc_arm', 'MAX32600MBED'),
  154. ('ds5_5', 'LPC1768'), ('ds5_5', 'LPC11U24'),
  155. ('iar', 'LPC1768'),
  156. ('iar', 'LPC4088_DM'),
  157. ('iar', 'LPC1347'),
  158. ('iar', 'NUCLEO_F030R8'),
  159. ('iar', 'NUCLEO_F070RB'),
  160. ('iar', 'NUCLEO_F072RB'),
  161. ('iar', 'NUCLEO_F091RC'),
  162. ('iar', 'NUCLEO_F302R8'),
  163. ('iar', 'NUCLEO_F303RE'),
  164. ('iar', 'NUCLEO_F334R8'),
  165. ('iar', 'NUCLEO_F401RE'),
  166. ('iar', 'NUCLEO_F411RE'),
  167. ('iar', 'NUCLEO_L053R8'),
  168. ('iar', 'NUCLEO_L073RZ'),
  169. ('iar', 'NUCLEO_L152RE'),
  170. ('iar', 'STM32F407'),
  171. ('iar', 'MTS_MDOT_F405RG'),
  172. ('iar', 'MTS_MDOT_F411RE'),
  173. ('iar', 'MAXWSNENV'),
  174. ('iar', 'MAX32600MBED'),
  175. # Removed following item to avoid script error
  176. #(None, None),
  177. ]:
  178. print '\n=== Exporting to "%s::%s" ===' % (toolchain, target)
  179. test_export(toolchain, target)
  180. print "\n=== Test error messages ==="
  181. test_export('lpcxpresso', 'LPC11U24', expected_error='lpcxpresso')