Keyboard firmwares for Atmel AVR and Cortex-M
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

codesourcery.py 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 splitext, basename
  16. class CodeSourcery(Exporter):
  17. NAME = 'CodeSourcery'
  18. TOOLCHAIN = 'GCC_CS'
  19. TARGETS = [
  20. 'LPC1768',
  21. 'UBLOX_C027',
  22. 'ARCH_PRO',
  23. ]
  24. DOT_IN_RELATIVE_PATH = True
  25. def generate(self):
  26. # "make" wants Unix paths
  27. self.resources.win_to_unix()
  28. to_be_compiled = []
  29. for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
  30. r = getattr(self.resources, r_type)
  31. if r:
  32. for source in r:
  33. base, ext = splitext(source)
  34. to_be_compiled.append(base + '.o')
  35. libraries = []
  36. for lib in self.resources.libraries:
  37. l, _ = splitext(basename(lib))
  38. libraries.append(l[3:])
  39. ctx = {
  40. 'name': self.program_name,
  41. 'to_be_compiled': to_be_compiled,
  42. 'object_files': self.resources.objects,
  43. 'include_paths': self.resources.inc_dirs,
  44. 'library_paths': self.resources.lib_dirs,
  45. 'linker_script': self.resources.linker_script,
  46. 'libraries': libraries,
  47. 'symbols': self.get_symbols()
  48. }
  49. self.gen_file('codesourcery_%s.tmpl' % self.target.lower(), ctx, 'Makefile')