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.

libraries.py 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 workspace_tools.paths import *
  15. from workspace_tools.data.support import *
  16. from workspace_tools.tests import TEST_MBED_LIB
  17. LIBRARIES = [
  18. # RTOS libraries
  19. {
  20. "id": "rtx",
  21. "source_dir": MBED_RTX,
  22. "build_dir": RTOS_LIBRARIES,
  23. "dependencies": [MBED_LIBRARIES],
  24. },
  25. {
  26. "id": "rtos",
  27. "source_dir": RTOS_ABSTRACTION,
  28. "build_dir": RTOS_LIBRARIES,
  29. "dependencies": [MBED_LIBRARIES, MBED_RTX],
  30. },
  31. # USB Device libraries
  32. {
  33. "id": "usb",
  34. "source_dir": USB,
  35. "build_dir": USB_LIBRARIES,
  36. "dependencies": [MBED_LIBRARIES],
  37. },
  38. # USB Host libraries
  39. {
  40. "id": "usb_host",
  41. "source_dir": USB_HOST,
  42. "build_dir": USB_HOST_LIBRARIES,
  43. "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],
  44. },
  45. # DSP libraries
  46. {
  47. "id": "cmsis_dsp",
  48. "source_dir": DSP_CMSIS,
  49. "build_dir": DSP_LIBRARIES,
  50. "dependencies": [MBED_LIBRARIES],
  51. },
  52. {
  53. "id": "dsp",
  54. "source_dir": DSP_ABSTRACTION,
  55. "build_dir": DSP_LIBRARIES,
  56. "dependencies": [MBED_LIBRARIES, DSP_CMSIS],
  57. },
  58. # File system libraries
  59. {
  60. "id": "fat",
  61. "source_dir": [FAT_FS, SD_FS],
  62. "build_dir": FS_LIBRARY,
  63. "dependencies": [MBED_LIBRARIES]
  64. },
  65. # Network libraries
  66. {
  67. "id": "eth",
  68. "source_dir": [ETH_SOURCES, LWIP_SOURCES],
  69. "build_dir": ETH_LIBRARY,
  70. "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES]
  71. },
  72. {
  73. "id": "ublox",
  74. "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, LWIP_SOURCES],
  75. "build_dir": UBLOX_LIBRARY,
  76. "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES],
  77. },
  78. # Unit Testing library
  79. {
  80. "id": "cpputest",
  81. "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR],
  82. "build_dir": CPPUTEST_LIBRARY,
  83. "dependencies": [MBED_LIBRARIES],
  84. 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB],
  85. 'inc_dirs_ext': [CPPUTEST_INC_EXT],
  86. 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"],
  87. },
  88. ]
  89. LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES])
  90. class Library:
  91. DEFAULTS = {
  92. "supported": DEFAULT_SUPPORT,
  93. 'dependencies': None,
  94. 'inc_dirs': None, # Include dirs required by library build
  95. 'inc_dirs_ext': None, # Include dirs required by others to use with this library
  96. 'macros': None, # Additional macros you want to define when building library
  97. }
  98. def __init__(self, lib_id):
  99. self.__dict__.update(Library.DEFAULTS)
  100. self.__dict__.update(LIBRARY_MAP[lib_id])
  101. def is_supported(self, target, toolchain):
  102. if not hasattr(self, 'supported'):
  103. return True
  104. return (target.name in self.supported) and (toolchain in self.supported[target.name])