Keyboard firmwares for Atmel AVR and Cortex-M
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

uvision4.py 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. from exporters import Exporter
  15. from os.path import basename
  16. class Uvision4(Exporter):
  17. NAME = 'uVision4'
  18. TARGETS = [
  19. 'LPC1768',
  20. 'LPC11U24',
  21. 'KL05Z',
  22. 'KL25Z',
  23. 'KL43Z',
  24. 'KL46Z',
  25. 'K64F',
  26. 'K22F',
  27. 'K20D50M',
  28. 'TEENSY3_1',
  29. 'LPC1347',
  30. 'LPC1114',
  31. 'LPC11C24',
  32. 'LPC4088',
  33. 'LPC4088_DM',
  34. 'LPC4330_M4',
  35. 'LPC4337',
  36. 'LPC812',
  37. 'NUCLEO_F030R8',
  38. 'NUCLEO_F070RB',
  39. 'NUCLEO_F072RB',
  40. 'NUCLEO_F091RC',
  41. 'NUCLEO_F103RB',
  42. 'NUCLEO_F302R8',
  43. 'NUCLEO_F303RE',
  44. 'NUCLEO_F334R8',
  45. 'NUCLEO_F401RE',
  46. 'NUCLEO_F411RE',
  47. 'NUCLEO_L053R8',
  48. 'NUCLEO_L073RZ',
  49. 'NUCLEO_L152RE',
  50. 'UBLOX_C027',
  51. 'LPC1549',
  52. 'LPC11U68',
  53. # Removed as uvision4_lpc11u35_501.uvproj.tmpl is missing.
  54. #'LPC11U35_501',
  55. 'NRF51822',
  56. 'HRM1017',
  57. 'RBLAB_NRF51822',
  58. 'ARCH_PRO',
  59. 'ARCH_BLE',
  60. 'DISCO_F407VG',
  61. 'DISCO_L053C8',
  62. 'MTS_GAMBIT',
  63. 'ARCH_MAX',
  64. 'MTS_MDOT_F405RG',
  65. 'NRF51_DK',
  66. 'NRF51_DONGLE',
  67. 'SEEED_TINY_BLE',
  68. 'LPC11U37H_401',
  69. 'DELTA_DFCM_NNN40',
  70. 'MAXWSNENV',
  71. 'MAX32600MBED',
  72. 'MOTE_L152RC',
  73. ]
  74. USING_MICROLIB = [
  75. 'LPC11U24',
  76. 'LPC1114',
  77. 'LPC11C24',
  78. 'LPC812',
  79. 'NUCLEO_F030R8',
  80. 'NUCLEO_F070RB',
  81. 'NUCLEO_F072RB',
  82. 'NUCLEO_F091RC',
  83. 'NUCLEO_F103RB',
  84. 'NUCLEO_F302R8',
  85. 'NUCLEO_F303RE',
  86. 'NUCLEO_F334R8',
  87. 'NUCLEO_F401RE',
  88. 'NUCLEO_F411RE',
  89. 'NUCLEO_L053R8',
  90. 'NUCLEO_L073RZ',
  91. 'NUCLEO_L152RE',
  92. 'LPC1549',
  93. 'LPC11U68',
  94. 'LPC11U35_501',
  95. 'KL05Z',
  96. 'LPC11U37H_401',
  97. 'MOTE_L152RC',
  98. ]
  99. FILE_TYPES = {
  100. 'c_sources':'1',
  101. 'cpp_sources':'8',
  102. 's_sources':'2'
  103. }
  104. FLAGS = [
  105. "--gnu", "--no_rtti",
  106. ]
  107. # By convention uVision projects do not show header files in the editor:
  108. # 'headers':'5',
  109. def get_toolchain(self):
  110. return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
  111. def get_flags(self):
  112. return self.FLAGS
  113. def generate(self):
  114. source_files = {
  115. 'mbed': [],
  116. 'hal': [],
  117. 'src': []
  118. }
  119. for r_type, n in Uvision4.FILE_TYPES.iteritems():
  120. for file in getattr(self.resources, r_type):
  121. f = {'name': basename(file), 'type': n, 'path': file}
  122. if file.startswith("mbed\\common"):
  123. source_files['mbed'].append(f)
  124. elif file.startswith("mbed\\targets"):
  125. source_files['hal'].append(f)
  126. else:
  127. source_files['src'].append(f)
  128. source_files = dict( [(k,v) for k,v in source_files.items() if len(v)>0])
  129. ctx = {
  130. 'name': self.program_name,
  131. 'include_paths': self.resources.inc_dirs,
  132. 'scatter_file': self.resources.linker_script,
  133. 'object_files': self.resources.objects + self.resources.libraries,
  134. 'source_files': source_files.items(),
  135. 'symbols': self.get_symbols() + ['__ASSERT_MSG'],
  136. 'hex_files' : self.resources.hex_files,
  137. 'flags' : self.get_flags(),
  138. }
  139. target = self.target.lower()
  140. # Project file
  141. self.gen_file('uvision4_%s.uvproj.tmpl' % target, ctx, '%s.uvproj' % self.program_name)
  142. self.gen_file('uvision4_%s.uvopt.tmpl' % target, ctx, '%s.uvopt' % self.program_name)