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.

404 lines
14 KiB

Massdrop keyboard support (#3780) * Massdrop SAMD51 Massdrop SAMD51 keyboards initial project upload * Removing relocated files Removing files that were relocated and not deleted from previous location * LED queue fix and cleaning Cleaned some white space or comments. Fix for LED I2C command queue. Cleaned up interrupts. Added debug function for printing numbers to scope through m15 line. * Factory programmed serial usage Ability to use factory programmed serial in hub and keyboard usb descriptors * USB serial number and bugfix Added support for factory programmed serial and usage. Incorporated bootloader's conditional compiling to align project closer. Fixed issue when USB device attempted to send before enabled. General white space and comment cleanup. * Project cleanup Cleaned up project in terms of white space, commented code, and unecessary files. NKRO keyboard is now using correct setreport although KBD was fine to use. Fixed broken linkage to __xprintf for serial debug statements. * Fix for extra keys Fixed possible USB hang on extra keys report set missing * I2C cleanup I2C cleanup and file renames necessary for master branch merge * Boot tracing and clocks cleanup Added optional boot debug trace mode through debug LED codes. General clock code cleanup. * Relocate ARM/Atmel headers Moved ARM/Atmel header folder from drivers to lib and made necessary makefile changes. * Pull request changes Pull request changes * Keymap and compile flag fix Keymap fix for momentary layer. Potential compile flag fix for Travis CI failure. * va_list include fix Fix for va_list compile failure * Include file case fixes Fixes for include files with incorrect case * ctrl and alt67 keyboard readme Added ctrl and alt67 keyboard readme files
5 years ago
Change split_common to use RGBLIGHT_SPLIT (#5509) * add I2C_slave_buffer_t to quantum/split_common/transport.c Improvements to ease the maintenance of the I2C slave buffer layout. And this commit does not change the compilation results. * add temporary pdhelix(Patched Helix) code * temporary cherry-pick from #5020 add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * add post_config.h support to build_keyboard.mk * add quantum/rgblight_post_config.h, quantum/split_common/post_config.h Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk. quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined. quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C. * Change split_common's transport.c I2C to use the synchronization feature of rgblight.c * Change split_common's transport.c serial to use the synchronization feature of rgblight.c * test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix * Test End Revert "test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix" This reverts commit 80118a6bbd3d9fc4c7797fef0c34bc67aa73aa98. [x] make RGBLIGHT_TEST=1 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/i2c:default (same RGBLIGHT_TEST=3) [x] make RGBLIGHT_TEST=3 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2_2oled:default * Test End, Revert "temporary cherry-pick from #5020" This reverts commit d35069f68bda0c50370442a5c7aae60c2f4ce5c0. * Test End, Revert "add temporary pdhelix(Patched Helix) code" This reverts commit aebddfc1a879796afae297ef0723a4fe73af3660. * temporarily cherry-pick from #5020 to see if it passes the travis-ci test. add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * Passed the travis-ci test. Revert "temporarily cherry-pick from #5020 to see if it passes the travis-ci test." This reverts commit 647c0a9755eb6a05f76d09b2d59bce67b85a841f. * update docs/config_options.md * update split_common/transport.c, improves maintainability of serial transaction IDs. No change in build result. * temporary cherry-pick from #5020 * fix build fail keebio/iris/rev3:default * fix build fail lets_split_eh/eh:default * Revert "temporary cherry-pick from #5020" This reverts commit be48ca1b4515366a097af8dd1cd7b28b7ee09947. * temporary cherry-pick from #5020 (0.6.336) * Revert "temporary cherry-pick from #5020 (0.6.336)" This reverts commit 978d26a8b3cf0acc485838a7d76d6128b77c630c. * temporary cherry-pick from #5020 (0.6.336)
5 years ago
Massdrop keyboard support (#3780) * Massdrop SAMD51 Massdrop SAMD51 keyboards initial project upload * Removing relocated files Removing files that were relocated and not deleted from previous location * LED queue fix and cleaning Cleaned some white space or comments. Fix for LED I2C command queue. Cleaned up interrupts. Added debug function for printing numbers to scope through m15 line. * Factory programmed serial usage Ability to use factory programmed serial in hub and keyboard usb descriptors * USB serial number and bugfix Added support for factory programmed serial and usage. Incorporated bootloader's conditional compiling to align project closer. Fixed issue when USB device attempted to send before enabled. General white space and comment cleanup. * Project cleanup Cleaned up project in terms of white space, commented code, and unecessary files. NKRO keyboard is now using correct setreport although KBD was fine to use. Fixed broken linkage to __xprintf for serial debug statements. * Fix for extra keys Fixed possible USB hang on extra keys report set missing * I2C cleanup I2C cleanup and file renames necessary for master branch merge * Boot tracing and clocks cleanup Added optional boot debug trace mode through debug LED codes. General clock code cleanup. * Relocate ARM/Atmel headers Moved ARM/Atmel header folder from drivers to lib and made necessary makefile changes. * Pull request changes Pull request changes * Keymap and compile flag fix Keymap fix for momentary layer. Potential compile flag fix for Travis CI failure. * va_list include fix Fix for va_list compile failure * Include file case fixes Fixes for include files with incorrect case * ctrl and alt67 keyboard readme Added ctrl and alt67 keyboard readme files
5 years ago
Merge ChibiOS and LUFA descriptor support (#2362) * Move lufa descriptor to protocol/usb_descriptor * Try to compile usb_descriptor on ChibiOS * Add lufa_utils for ChibiOS Lufa USB descriptors for ChibiOS * More lufa_util compatibility fixes * First compiling version of shared USB descriptor * Send the usb descriptors * Fix the CONSOLE output on ChibiOS * Add errors for unsupported interfaces * Enable support for vitual serial port USB descriptors * Implement virtual serial port for ChibiOS * Cleanup the lufa_utils Use the default lufa header files * Add raw hid support for ChibiOS This is completely untested * Enable midi compilation on ChibiOS * Move midi functionality out of lufa.c * Don't register sysex callback when not needed * ChibiOS compilation fixes * Update ChibiOS submodule * Fix the Midi USB descriptor It didn't work properly when both Midi and Virtual serial port was enabled. * Add MIDI support for ChibiOS * Fix USB descriptor strings on ChibiOS * Use serial usb driver for raw hid * Generalize the ChibiOS stream like drivers This makes the initialization much more simple and eliminates a lot of the code duplication. * Convert console output to chibios stream driver * Fixes for ChibiOS update * Update the ChibiOS contrib submodule To include the usb data toggle synchronization fixes * Fix duplicate reset enumeration on ChibiOS * Add missing include * Add number of endpoints check for ChibiOS * Enable serial USB driver on all keyboards * Add missing includes when API is enabled withot midi * Add another missing inlcude
6 years ago
Change split_common to use RGBLIGHT_SPLIT (#5509) * add I2C_slave_buffer_t to quantum/split_common/transport.c Improvements to ease the maintenance of the I2C slave buffer layout. And this commit does not change the compilation results. * add temporary pdhelix(Patched Helix) code * temporary cherry-pick from #5020 add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * add post_config.h support to build_keyboard.mk * add quantum/rgblight_post_config.h, quantum/split_common/post_config.h Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk. quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined. quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C. * Change split_common's transport.c I2C to use the synchronization feature of rgblight.c * Change split_common's transport.c serial to use the synchronization feature of rgblight.c * test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix * Test End Revert "test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix" This reverts commit 80118a6bbd3d9fc4c7797fef0c34bc67aa73aa98. [x] make RGBLIGHT_TEST=1 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/i2c:default (same RGBLIGHT_TEST=3) [x] make RGBLIGHT_TEST=3 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2_2oled:default * Test End, Revert "temporary cherry-pick from #5020" This reverts commit d35069f68bda0c50370442a5c7aae60c2f4ce5c0. * Test End, Revert "add temporary pdhelix(Patched Helix) code" This reverts commit aebddfc1a879796afae297ef0723a4fe73af3660. * temporarily cherry-pick from #5020 to see if it passes the travis-ci test. add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * Passed the travis-ci test. Revert "temporarily cherry-pick from #5020 to see if it passes the travis-ci test." This reverts commit 647c0a9755eb6a05f76d09b2d59bce67b85a841f. * update docs/config_options.md * update split_common/transport.c, improves maintainability of serial transaction IDs. No change in build result. * temporary cherry-pick from #5020 * fix build fail keebio/iris/rev3:default * fix build fail lets_split_eh/eh:default * Revert "temporary cherry-pick from #5020" This reverts commit be48ca1b4515366a097af8dd1cd7b28b7ee09947. * temporary cherry-pick from #5020 (0.6.336) * Revert "temporary cherry-pick from #5020 (0.6.336)" This reverts commit 978d26a8b3cf0acc485838a7d76d6128b77c630c. * temporary cherry-pick from #5020 (0.6.336)
5 years ago
  1. # Determine what keyboard we are building and setup the build environment.
  2. #
  3. # We support folders up to 5 levels deep below `keyboards/`. This file is
  4. # responsible for determining which folder is being used and doing the
  5. # corresponding environment setup.
  6. ifndef VERBOSE
  7. .SILENT:
  8. endif
  9. .DEFAULT_GOAL := all
  10. include common.mk
  11. # Set the filename for the final firmware binary
  12. KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
  13. TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
  14. KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
  15. STM32_PATH := quantum/stm32
  16. # Force expansion
  17. TARGET := $(TARGET)
  18. # For split boards we need to set a master half.
  19. MASTER ?= left
  20. ifdef master
  21. MASTER = $(master)
  22. endif
  23. ifeq ($(MASTER),right)
  24. OPT_DEFS += -DMASTER_IS_ON_RIGHT
  25. else
  26. ifneq ($(MASTER),left)
  27. $(error MASTER does not have a valid value(left/right))
  28. endif
  29. endif
  30. ifdef SKIP_VERSION
  31. OPT_DEFS += -DSKIP_VERSION
  32. endif
  33. # Determine which subfolders exist.
  34. KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
  35. KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
  36. KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
  37. KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
  38. KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
  39. KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
  40. KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
  41. KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
  42. KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
  43. KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
  44. KEYBOARD_PATHS :=
  45. KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
  46. KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
  47. KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
  48. KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
  49. KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
  50. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  51. KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
  52. endif
  53. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  54. KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
  55. endif
  56. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  57. KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
  58. endif
  59. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  60. KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
  61. endif
  62. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  63. KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
  64. endif
  65. # Pull in rules.mk files from all our subfolders
  66. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
  67. include $(KEYBOARD_PATH_5)/rules.mk
  68. endif
  69. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
  70. include $(KEYBOARD_PATH_4)/rules.mk
  71. endif
  72. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
  73. include $(KEYBOARD_PATH_3)/rules.mk
  74. endif
  75. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
  76. include $(KEYBOARD_PATH_2)/rules.mk
  77. endif
  78. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
  79. include $(KEYBOARD_PATH_1)/rules.mk
  80. endif
  81. MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
  82. MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
  83. MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
  84. MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
  85. MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
  86. # Check for keymap.json first, so we can regenerate keymap.c
  87. include build_json.mk
  88. ifeq ("$(wildcard $(KEYMAP_PATH))", "")
  89. # Look through the possible keymap folders until we find a matching keymap.c
  90. ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
  91. -include $(MAIN_KEYMAP_PATH_5)/rules.mk
  92. KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
  93. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
  94. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
  95. -include $(MAIN_KEYMAP_PATH_4)/rules.mk
  96. KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
  97. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
  98. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
  99. -include $(MAIN_KEYMAP_PATH_3)/rules.mk
  100. KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
  101. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
  102. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
  103. -include $(MAIN_KEYMAP_PATH_2)/rules.mk
  104. KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
  105. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
  106. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
  107. -include $(MAIN_KEYMAP_PATH_1)/rules.mk
  108. KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
  109. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
  110. else ifneq ($(LAYOUTS),)
  111. # If we haven't found a keymap yet fall back to community layouts
  112. include build_layout.mk
  113. else
  114. $(error Could not find keymap)
  115. # this state should never be reached
  116. endif
  117. endif
  118. ifeq ($(strip $(CTPC)), yes)
  119. CONVERT_TO_PROTON_C=yes
  120. endif
  121. ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
  122. TARGET := $(TARGET)_proton_c
  123. include $(STM32_PATH)/proton_c.mk
  124. OPT_DEFS += -DCONVERT_TO_PROTON_C
  125. endif
  126. ifneq ($(FORCE_LAYOUT),)
  127. TARGET := $(TARGET)_$(FORCE_LAYOUT)
  128. endif
  129. include quantum/mcu_selection.mk
  130. ifdef MCU_FAMILY
  131. OPT_DEFS += -DQMK_STM32
  132. KEYBOARD_PATHS += $(STM32_PATH)
  133. endif
  134. # Find all the C source files to be compiled in subfolders.
  135. KEYBOARD_SRC :=
  136. KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
  137. KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
  138. KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
  139. KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
  140. KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
  141. ifneq ("$(wildcard $(KEYBOARD_C_5))","")
  142. KEYBOARD_SRC += $(KEYBOARD_C_5)
  143. endif
  144. ifneq ("$(wildcard $(KEYBOARD_C_4))","")
  145. KEYBOARD_SRC += $(KEYBOARD_C_4)
  146. endif
  147. ifneq ("$(wildcard $(KEYBOARD_C_3))","")
  148. KEYBOARD_SRC += $(KEYBOARD_C_3)
  149. endif
  150. ifneq ("$(wildcard $(KEYBOARD_C_2))","")
  151. KEYBOARD_SRC += $(KEYBOARD_C_2)
  152. endif
  153. ifneq ("$(wildcard $(KEYBOARD_C_1))","")
  154. KEYBOARD_SRC += $(KEYBOARD_C_1)
  155. endif
  156. # Generate KEYBOARD_name_subname for all levels of the keyboard folder
  157. KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
  158. KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
  159. KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
  160. KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
  161. KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
  162. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  163. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
  164. endif
  165. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  166. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
  167. endif
  168. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  169. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
  170. endif
  171. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  172. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
  173. endif
  174. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  175. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
  176. endif
  177. # Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
  178. # that the same keymap may be used on multiple keyboards.
  179. #
  180. # We grab the most top-level include file that we can. That file should
  181. # use #ifdef statements to include all the neccesary subfolder includes,
  182. # as described here:
  183. #
  184. # https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
  185. #
  186. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
  187. QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
  188. endif
  189. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
  190. QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
  191. endif
  192. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
  193. QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
  194. endif
  195. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
  196. QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
  197. endif
  198. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
  199. QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
  200. endif
  201. # Determine and set parameters based on the keyboard's processor family.
  202. # We can assume a ChibiOS target When MCU_FAMILY is defined since it's
  203. # not used for LUFA
  204. ifdef MCU_FAMILY
  205. FIRMWARE_FORMAT?=bin
  206. PLATFORM=CHIBIOS
  207. else ifdef ARM_ATSAM
  208. PLATFORM=ARM_ATSAM
  209. FIRMWARE_FORMAT=bin
  210. else
  211. PLATFORM=AVR
  212. FIRMWARE_FORMAT?=hex
  213. endif
  214. ifeq ($(PLATFORM),CHIBIOS)
  215. include $(TMK_PATH)/chibios.mk
  216. OPT_OS = chibios
  217. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
  218. OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
  219. else ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h)","")
  220. OPT_DEFS += -include $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h
  221. else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/bootloader_defs.h)","")
  222. OPT_DEFS += -include $(KEYBOARD_PATH_4)/bootloader_defs.h
  223. else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h)","")
  224. OPT_DEFS += -include $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h
  225. else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/bootloader_defs.h)","")
  226. OPT_DEFS += -include $(KEYBOARD_PATH_3)/bootloader_defs.h
  227. else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h)","")
  228. OPT_DEFS += -include $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h
  229. else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/bootloader_defs.h)","")
  230. OPT_DEFS += -include $(KEYBOARD_PATH_2)/bootloader_defs.h
  231. else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h)","")
  232. OPT_DEFS += -include $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h
  233. else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/bootloader_defs.h)","")
  234. OPT_DEFS += -include $(KEYBOARD_PATH_1)/bootloader_defs.h
  235. else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h)","")
  236. OPT_DEFS += -include $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h
  237. else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h)","")
  238. OPT_DEFS += -include $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h
  239. endif
  240. endif
  241. # Find all of the config.h files and add them to our CONFIG_H define.
  242. CONFIG_H :=
  243. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
  244. CONFIG_H += $(KEYBOARD_PATH_5)/config.h
  245. endif
  246. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
  247. CONFIG_H += $(KEYBOARD_PATH_4)/config.h
  248. endif
  249. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
  250. CONFIG_H += $(KEYBOARD_PATH_3)/config.h
  251. endif
  252. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
  253. CONFIG_H += $(KEYBOARD_PATH_2)/config.h
  254. endif
  255. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
  256. CONFIG_H += $(KEYBOARD_PATH_1)/config.h
  257. endif
  258. POST_CONFIG_H :=
  259. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
  260. POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
  261. endif
  262. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
  263. POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
  264. endif
  265. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
  266. POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
  267. endif
  268. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
  269. POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
  270. endif
  271. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
  272. POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
  273. endif
  274. # Save the defines and includes here, so we don't include any keymap specific ones
  275. PROJECT_DEFS := $(OPT_DEFS)
  276. PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
  277. PROJECT_CONFIG := $(CONFIG_H)
  278. # Userspace setup and definitions
  279. ifeq ("$(USER_NAME)","")
  280. USER_NAME := $(KEYMAP)
  281. endif
  282. USER_PATH := users/$(USER_NAME)
  283. -include $(USER_PATH)/rules.mk
  284. ifneq ("$(wildcard $(USER_PATH)/config.h)","")
  285. CONFIG_H += $(USER_PATH)/config.h
  286. endif
  287. # Object files directory
  288. # To put object files in current directory, use a dot (.), do NOT make
  289. # this an empty or blank macro!
  290. KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
  291. ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
  292. CONFIG_H += $(KEYMAP_PATH)/config.h
  293. endif
  294. # project specific files
  295. SRC += $(KEYBOARD_SRC) \
  296. $(KEYMAP_C) \
  297. $(QUANTUM_SRC)
  298. # Optimize size but this may cause error "relocation truncated to fit"
  299. #EXTRALDFLAGS = -Wl,--relax
  300. # Search Path
  301. VPATH += $(KEYMAP_PATH)
  302. VPATH += $(USER_PATH)
  303. VPATH += $(KEYBOARD_PATHS)
  304. VPATH += $(COMMON_VPATH)
  305. include common_features.mk
  306. include $(TMK_PATH)/protocol.mk
  307. include $(TMK_PATH)/common.mk
  308. include bootloader.mk
  309. SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
  310. SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
  311. SRC += $(TMK_COMMON_SRC)
  312. OPT_DEFS += $(TMK_COMMON_DEFS)
  313. EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
  314. ifeq ($(PLATFORM),AVR)
  315. ifeq ($(strip $(PROTOCOL)), VUSB)
  316. include $(TMK_PATH)/protocol/vusb.mk
  317. else
  318. include $(TMK_PATH)/protocol/lufa.mk
  319. endif
  320. include $(TMK_PATH)/avr.mk
  321. endif
  322. ifeq ($(PLATFORM),ARM_ATSAM)
  323. include $(TMK_PATH)/arm_atsam.mk
  324. include $(TMK_PATH)/protocol/arm_atsam.mk
  325. endif
  326. ifeq ($(PLATFORM),CHIBIOS)
  327. include $(TMK_PATH)/protocol/chibios.mk
  328. endif
  329. ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
  330. VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
  331. VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
  332. include $(VISUALIZER_PATH)/visualizer.mk
  333. endif
  334. CONFIG_H += $(POST_CONFIG_H)
  335. ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
  336. OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
  337. $(KEYMAP_OUTPUT)_SRC := $(SRC)
  338. $(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) $(GFXDEFS) \
  339. -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(QMK_KEYBOARD_H)\" -DQMK_KEYBOARD_CONFIG_H=\"$(KEYBOARD_PATH_1)/config.h\" \
  340. -DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\" \
  341. -DQMK_SUBPROJECT -DQMK_SUBPROJECT_H -DQMK_SUBPROJECT_CONFIG_H
  342. $(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
  343. $(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
  344. $(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) $(GFXSRC)
  345. $(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS) $(GFXDEFS)
  346. $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
  347. $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
  348. # Default target.
  349. all: build check-size
  350. build: elf cpfirmware
  351. check-size: build
  352. objs-size: build
  353. include show_options.mk
  354. include $(TMK_PATH)/rules.mk