Keyboard firmwares for Atmel AVR and Cortex-M
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

coide.py 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. """
  2. mbed SDK
  3. Copyright (c) 2014 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 splitext, basename
  16. class CoIDE(Exporter):
  17. NAME = 'CoIDE'
  18. TOOLCHAIN = 'GCC_ARM'
  19. TARGETS = [
  20. 'KL25Z',
  21. 'KL05Z',
  22. 'LPC1768',
  23. 'ARCH_PRO',
  24. 'ARCH_MAX',
  25. 'UBLOX_C027',
  26. 'NUCLEO_L053R8',
  27. 'NUCLEO_L152RE',
  28. 'NUCLEO_F030R8',
  29. 'NUCLEO_F070RB',
  30. 'NUCLEO_F072RB',
  31. 'NUCLEO_F091RC',
  32. 'NUCLEO_F103RB',
  33. 'NUCLEO_F302R8',
  34. 'NUCLEO_F303RE',
  35. 'NUCLEO_F334R8',
  36. 'NUCLEO_F401RE',
  37. 'NUCLEO_F411RE',
  38. 'DISCO_L053C8',
  39. 'DISCO_F051R8',
  40. 'DISCO_F100RB',
  41. 'DISCO_F303VC',
  42. 'DISCO_F334C8',
  43. 'DISCO_F401VC',
  44. 'DISCO_F407VG',
  45. 'DISCO_F429ZI',
  46. 'MTS_MDOT_F405RG',
  47. 'MTS_MDOT_F411RE',
  48. 'MOTE_L152RC',
  49. ]
  50. # seems like CoIDE currently supports only one type
  51. FILE_TYPES = {
  52. 'c_sources':'1',
  53. 'cpp_sources':'1',
  54. 's_sources':'1'
  55. }
  56. FILE_TYPES2 = {
  57. 'headers':'1'
  58. }
  59. def generate(self):
  60. self.resources.win_to_unix()
  61. source_files = []
  62. for r_type, n in CoIDE.FILE_TYPES.iteritems():
  63. for file in getattr(self.resources, r_type):
  64. source_files.append({
  65. 'name': basename(file), 'type': n, 'path': file
  66. })
  67. header_files = []
  68. for r_type, n in CoIDE.FILE_TYPES2.iteritems():
  69. for file in getattr(self.resources, r_type):
  70. header_files.append({
  71. 'name': basename(file), 'type': n, 'path': file
  72. })
  73. libraries = []
  74. for lib in self.resources.libraries:
  75. l, _ = splitext(basename(lib))
  76. libraries.append(l[3:])
  77. if self.resources.linker_script is None:
  78. self.resources.linker_script = ''
  79. ctx = {
  80. 'name': self.program_name,
  81. 'source_files': source_files,
  82. 'header_files': header_files,
  83. 'include_paths': self.resources.inc_dirs,
  84. 'scatter_file': self.resources.linker_script,
  85. 'library_paths': self.resources.lib_dirs,
  86. 'object_files': self.resources.objects,
  87. 'libraries': libraries,
  88. 'symbols': self.get_symbols()
  89. }
  90. target = self.target.lower()
  91. # Project file
  92. self.gen_file('coide_%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.program_name)