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.

chibios.mk 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. ##############################################################################
  2. # Build global options
  3. # NOTE: Can be overridden externally.
  4. #
  5. # Compiler options here.
  6. ifeq ($(USE_OPT),)
  7. USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -DPROTOCOL_CHIBIOS
  8. endif
  9. # C specific options here (added to USE_OPT).
  10. ifeq ($(USE_COPT),)
  11. USE_COPT =
  12. endif
  13. # include specific config.h?
  14. ifdef CONFIG_H
  15. USE_COPT += -include $(CONFIG_H)
  16. endif
  17. # C++ specific options here (added to USE_OPT).
  18. ifeq ($(USE_CPPOPT),)
  19. USE_CPPOPT = -fno-rtti
  20. endif
  21. # Enable this if you want the linker to remove unused code and data
  22. ifeq ($(USE_LINK_GC),)
  23. USE_LINK_GC = yes
  24. endif
  25. # Linker extra options here.
  26. ifeq ($(USE_LDOPT),)
  27. USE_LDOPT =
  28. endif
  29. # Enable this if you want link time optimizations (LTO)
  30. ifeq ($(USE_LTO),)
  31. USE_LTO = yes
  32. endif
  33. # If enabled, this option allows to compile the application in THUMB mode.
  34. ifeq ($(USE_THUMB),)
  35. USE_THUMB = yes
  36. endif
  37. # Enable this if you want to see the full log while compiling.
  38. ifeq ($(USE_VERBOSE_COMPILE),)
  39. USE_VERBOSE_COMPILE = no
  40. endif
  41. # If enabled, this option makes the build process faster by not compiling
  42. # modules not used in the current configuration.
  43. ifeq ($(USE_SMART_BUILD),)
  44. USE_SMART_BUILD = yes
  45. endif
  46. #
  47. # Build global options
  48. ##############################################################################
  49. ##############################################################################
  50. # Architecture or project specific options
  51. #
  52. # Stack size to be allocated to the Cortex-M process stack. This stack is
  53. # the stack used by the main() thread.
  54. ifeq ($(USE_PROCESS_STACKSIZE),)
  55. USE_PROCESS_STACKSIZE = 0x200
  56. endif
  57. # Stack size to the allocated to the Cortex-M main/exceptions stack. This
  58. # stack is used for processing interrupts and exceptions.
  59. ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  60. USE_EXCEPTIONS_STACKSIZE = 0x400
  61. endif
  62. #
  63. # Architecture or project specific options
  64. ##############################################################################
  65. ##############################################################################
  66. # Project, sources and paths
  67. #
  68. # Imported source files and paths
  69. CHIBIOS = $(TMK_DIR)/tool/chibios/chibios
  70. # Startup files.
  71. include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
  72. # HAL-OSAL files (optional).
  73. include $(CHIBIOS)/os/hal/hal.mk
  74. include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk
  75. ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD))","")
  76. include $(TARGET_DIR)/boards/$(BOARD)/board.mk
  77. else
  78. include $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk
  79. endif
  80. include $(CHIBIOS)/os/hal/osal/rt/osal.mk
  81. # RTOS files (optional).
  82. include $(CHIBIOS)/os/rt/rt.mk
  83. include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
  84. # Other files (optional).
  85. # Define linker script file here
  86. ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld)","")
  87. LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld
  88. else
  89. LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld
  90. endif
  91. # C sources that can be compiled in ARM or THUMB mode depending on the global
  92. # setting.
  93. CSRC = $(STARTUPSRC) \
  94. $(KERNSRC) \
  95. $(PORTSRC) \
  96. $(OSALSRC) \
  97. $(HALSRC) \
  98. $(PLATFORMSRC) \
  99. $(BOARDSRC) \
  100. $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
  101. $(TMK_DIR)/protocol/chibios/usb_main.c \
  102. $(TMK_DIR)/protocol/chibios/main.c \
  103. $(SRC)
  104. # C++ sources that can be compiled in ARM or THUMB mode depending on the global
  105. # setting.
  106. CPPSRC =
  107. # C sources to be compiled in ARM mode regardless of the global setting.
  108. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  109. # option that results in lower performance and larger code size.
  110. ACSRC =
  111. # C++ sources to be compiled in ARM mode regardless of the global setting.
  112. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  113. # option that results in lower performance and larger code size.
  114. ACPPSRC =
  115. # C sources to be compiled in THUMB mode regardless of the global setting.
  116. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  117. # option that results in lower performance and larger code size.
  118. TCSRC =
  119. # C sources to be compiled in THUMB mode regardless of the global setting.
  120. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  121. # option that results in lower performance and larger code size.
  122. TCPPSRC =
  123. # List ASM source files here
  124. ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
  125. INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
  126. $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
  127. $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \
  128. $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \
  129. $(TMK_DIR)/protocol $(TARGET_DIR)
  130. #
  131. # Project, sources and paths
  132. ##############################################################################
  133. ##############################################################################
  134. # Compiler settings
  135. #
  136. #TRGT = arm-elf-
  137. TRGT = arm-none-eabi-
  138. CC = $(TRGT)gcc
  139. CPPC = $(TRGT)g++
  140. # Enable loading with g++ only if you need C++ runtime support.
  141. # NOTE: You can use C++ even without C++ support if you are careful. C++
  142. # runtime support makes code size explode.
  143. LD = $(TRGT)gcc
  144. #LD = $(TRGT)g++
  145. CP = $(TRGT)objcopy
  146. AS = $(TRGT)gcc -x assembler-with-cpp
  147. AR = $(TRGT)ar
  148. OD = $(TRGT)objdump
  149. SZ = $(TRGT)size
  150. HEX = $(CP) -O ihex
  151. BIN = $(CP) -O binary
  152. # ARM-specific options here
  153. AOPT =
  154. # THUMB-specific options here
  155. TOPT = -mthumb -DTHUMB
  156. # Define C warning options here
  157. CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-missing-field-initializers
  158. # Define C++ warning options here
  159. CPPWARN = -Wall -Wextra -Wundef
  160. #
  161. # Compiler settings
  162. ##############################################################################
  163. ##############################################################################
  164. # Start of user section
  165. #
  166. # List all user C define here, like -D_DEBUG=1
  167. ## Select which interfaces to include here!
  168. UDEFS += $(OPT_DEFS)
  169. # Define ASM defines here
  170. UADEFS += $(OPT_DEFS)
  171. # bootloader definitions may be used in the startup .s file
  172. ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","")
  173. UADEFS += -include $(TARGET_DIR)/bootloader_defs.h
  174. UDEFS += -include $(TARGET_DIR)/bootloader_defs.h
  175. else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","")
  176. UADEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h
  177. UDEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h
  178. endif
  179. # List all user directories here
  180. #UINCDIR =
  181. # List the user directory to look for the libraries here
  182. #ULIBDIR =
  183. # List all user libraries here
  184. #ULIBS =
  185. #
  186. # End of user defines
  187. ##############################################################################
  188. RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
  189. include $(RULESPATH)/rules.mk