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.

566 lines
21 KiB

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
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
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
Add target 'check-md5' to `build_keyboard.mk` (#11338) * Add target 'build-for-compare' to `build_keyboard.mk` The `build-for-compare` target provides an easy way to check the md5 checksum of the generated binary. You can easily see if there is any change in the generated binaries between the two versions, as in the example below. ``` $ git checkout 0.11.0 M build_keyboard.mk M tmk_core/rules.mk Note: checking out '0.11.0'. HEAD is now at c66df1664 2020 November 28 Breaking Changes Update (#11053) $ make helix:all:build-for-compare | grep ^MD5 MD5 (.build/helix_rev2_default.hex) = 5c3606562c944bb4d18832e601b45d4a MD5 (.build/helix_rev2_edvorakjp.hex) = 9e43d13d389d518ba7e99cd7337e28d6 MD5 (.build/helix_rev2_five_rows.hex) = 8bcb61c2fd5d237c2997f2fa007d4934 MD5 (.build/helix_rev2_five_rows_jis.hex) = b97cd818d52f73ca2d4e78c86d90a791 MD5 (.build/helix_rev2_froggy.hex) = c492172364188f4e2918b10bf0f3a0a6 MD5 (.build/helix_rev2_froggy_106.hex) = b0861fd735a8f81881a8c02730641a2b MD5 (.build/helix_rev2_led_test.hex) = 5c97d982a5da5cfb3dacb28a8934b81d MD5 (.build/helix_rev2_xulkal.hex) = 01f603dc46bcf9094d7e106831d8f5b1 MD5 (.build/helix_rev2_yshrsmz.hex) = 5a008bca2d0c5790a151c02834c529ba $ git checkout 0.11.1 M build_keyboard.mk M tmk_core/rules.mk Previous HEAD position was c66df1664 2020 November 28 Breaking Changes Update (#11053) HEAD is now at cc08e3082 nix-shell: add milc dependency (#11086) $ make helix:all:build-for-compare | grep ^MD5 MD5 (.build/helix_rev2_default.hex) = 5c3606562c944bb4d18832e601b45d4a MD5 (.build/helix_rev2_edvorakjp.hex) = 9e43d13d389d518ba7e99cd7337e28d6 MD5 (.build/helix_rev2_five_rows.hex) = 8bcb61c2fd5d237c2997f2fa007d4934 MD5 (.build/helix_rev2_five_rows_jis.hex) = b97cd818d52f73ca2d4e78c86d90a791 MD5 (.build/helix_rev2_froggy.hex) = c492172364188f4e2918b10bf0f3a0a6 MD5 (.build/helix_rev2_froggy_106.hex) = b0861fd735a8f81881a8c02730641a2b MD5 (.build/helix_rev2_led_test.hex) = 5c97d982a5da5cfb3dacb28a8934b81d MD5 (.build/helix_rev2_xulkal.hex) = d848383adfd7463b138c6da179cf1436 MD5 (.build/helix_rev2_yshrsmz.hex) = 5a008bca2d0c5790a151c02834c529ba ``` * make builds reproducable by default * update build_keyboard.mk: remove 'build-for-compare' target * GNU make (3.81) on macOS 10.14(Mojave) does not have the 'undefine' directive. * Adopted fauxpark's suggestion. * Update tmk_core/rules.mk Co-authored-by: Ryan <fauxpark@gmail.com> * update tmk_core/rules.mk * fix tmk_core/rules.mk Co-authored-by: Zach White <skullydazed@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
3 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 paths.mk
  11. include $(BUILDDEFS_PATH)/message.mk
  12. # Helper to add defines with a 'QMK_' prefix
  13. define add_qmk_prefix_defs
  14. ifdef $1
  15. # Need to cater for 'STM32L4xx+'
  16. OPT_DEFS += -DQMK_$(2)="$($1)" -DQMK_$(2)_$(shell echo $($1) | sed -e 's@+@Plus@g' -e 's@[^a-zA-Z0-9]@_@g' | tr '[:lower:]' '[:upper:]')
  17. endif
  18. endef
  19. # Set the qmk cli to use
  20. QMK_BIN ?= qmk
  21. # Set the filename for the final firmware binary
  22. KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
  23. TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
  24. ifeq ($(strip $(DUMP_CI_METADATA)),yes)
  25. $(info CI Metadata: KEYBOARD=$(KEYBOARD))
  26. $(info CI Metadata: KEYMAP=$(KEYMAP))
  27. endif
  28. # Force expansion
  29. TARGET := $(TARGET)
  30. ifneq ($(FORCE_LAYOUT),)
  31. TARGET := $(TARGET)_$(FORCE_LAYOUT)
  32. endif
  33. # Object files and generated keymap directory
  34. # To put object files in current directory, use a dot (.), do NOT make
  35. # this an empty or blank macro!
  36. INTERMEDIATE_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
  37. ifdef SKIP_VERSION
  38. OPT_DEFS += -DSKIP_VERSION
  39. endif
  40. # Generate the version.h file
  41. VERSION_H_FLAGS :=
  42. ifdef SKIP_VERSION
  43. VERSION_H_FLAGS += --skip-all
  44. endif
  45. ifdef SKIP_GIT
  46. VERSION_H_FLAGS += --skip-git
  47. endif
  48. # Generate the board's version.h file.
  49. $(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(INTERMEDIATE_OUTPUT)/src/version.h)
  50. # Determine which subfolders exist.
  51. KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
  52. KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
  53. KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
  54. KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
  55. KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
  56. KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
  57. KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
  58. KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
  59. KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
  60. KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
  61. KEYBOARD_PATHS :=
  62. KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
  63. KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
  64. KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
  65. KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
  66. KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
  67. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  68. KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
  69. endif
  70. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  71. KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
  72. endif
  73. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  74. KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
  75. endif
  76. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  77. KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
  78. endif
  79. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  80. KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
  81. endif
  82. # Pull in rules.mk files from all our subfolders
  83. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
  84. include $(KEYBOARD_PATH_5)/rules.mk
  85. endif
  86. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
  87. include $(KEYBOARD_PATH_4)/rules.mk
  88. endif
  89. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
  90. include $(KEYBOARD_PATH_3)/rules.mk
  91. endif
  92. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
  93. include $(KEYBOARD_PATH_2)/rules.mk
  94. endif
  95. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
  96. include $(KEYBOARD_PATH_1)/rules.mk
  97. endif
  98. MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
  99. MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
  100. MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
  101. MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
  102. MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
  103. # Pull in rules from DD keyboard config
  104. INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/info_rules.mk)
  105. include $(INFO_RULES_MK)
  106. # Check for keymap.json first, so we can regenerate keymap.c
  107. include $(BUILDDEFS_PATH)/build_json.mk
  108. # Pull in keymap level rules.mk
  109. ifeq ("$(wildcard $(KEYMAP_PATH))", "")
  110. # Look through the possible keymap folders until we find a matching keymap.c
  111. ifneq ($(QMK_USERSPACE),)
  112. ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c)","")
  113. -include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/rules.mk
  114. KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c
  115. KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)
  116. else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c)","")
  117. -include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/rules.mk
  118. KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c
  119. KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)
  120. else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c)","")
  121. -include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/rules.mk
  122. KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c
  123. KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)
  124. else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c)","")
  125. -include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/rules.mk
  126. KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c
  127. KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)
  128. else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c)","")
  129. -include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/rules.mk
  130. KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c
  131. KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)
  132. endif
  133. endif
  134. ifeq ($(KEYMAP_PATH),)
  135. ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
  136. -include $(MAIN_KEYMAP_PATH_1)/rules.mk
  137. KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
  138. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
  139. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
  140. -include $(MAIN_KEYMAP_PATH_2)/rules.mk
  141. KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
  142. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
  143. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
  144. -include $(MAIN_KEYMAP_PATH_3)/rules.mk
  145. KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
  146. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
  147. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
  148. -include $(MAIN_KEYMAP_PATH_4)/rules.mk
  149. KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
  150. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
  151. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
  152. -include $(MAIN_KEYMAP_PATH_5)/rules.mk
  153. KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
  154. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
  155. else ifneq ($(LAYOUTS),)
  156. # If we haven't found a keymap yet fall back to community layouts
  157. include $(BUILDDEFS_PATH)/build_layout.mk
  158. else ifeq ("$(wildcard $(KEYMAP_JSON_PATH))", "") # Not finding keymap.c is fine if we found a keymap.json
  159. $(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
  160. # this state should never be reached
  161. endif
  162. endif
  163. endif
  164. # Have we found a keymap.json?
  165. ifneq ("$(wildcard $(KEYMAP_JSON))", "")
  166. ifneq ("$(wildcard $(KEYMAP_C))", "")
  167. $(call WARNING_MESSAGE,Keymap is specified as both keymap.json and keymap.c -- keymap.json file wins.)
  168. endif
  169. KEYMAP_PATH := $(KEYMAP_JSON_PATH)
  170. KEYMAP_C := $(INTERMEDIATE_OUTPUT)/src/keymap.c
  171. KEYMAP_H := $(INTERMEDIATE_OUTPUT)/src/config.h
  172. # Load the keymap-level rules.mk if exists
  173. -include $(KEYMAP_PATH)/rules.mk
  174. # Load any rules.mk content from keymap.json
  175. INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --output $(INTERMEDIATE_OUTPUT)/src/rules.mk $(KEYMAP_JSON))
  176. include $(INFO_RULES_MK)
  177. # Add rules to generate the keymap files - indentation here is important
  178. $(INTERMEDIATE_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
  179. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  180. $(eval CMD=$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON))
  181. @$(BUILD_CMD)
  182. $(INTERMEDIATE_OUTPUT)/src/config.h: $(KEYMAP_JSON)
  183. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  184. $(eval CMD=$(QMK_BIN) generate-config-h --quiet --output $(KEYMAP_H) $(KEYMAP_JSON))
  185. @$(BUILD_CMD)
  186. generated-files: $(INTERMEDIATE_OUTPUT)/src/config.h $(INTERMEDIATE_OUTPUT)/src/keymap.c
  187. endif
  188. include $(BUILDDEFS_PATH)/converters.mk
  189. MCU_ORIG := $(MCU)
  190. include $(wildcard $(PLATFORM_PATH)/*/mcu_selection.mk)
  191. # PLATFORM_KEY should be detected in DD keyboard config via key 'processor' (or rules.mk 'MCU')
  192. ifeq ($(PLATFORM_KEY),)
  193. $(call CATASTROPHIC_ERROR,Platform not defined)
  194. endif
  195. PLATFORM=$(shell echo $(PLATFORM_KEY) | tr '[:lower:]' '[:upper:]')
  196. # Find all the C source files to be compiled in subfolders.
  197. KEYBOARD_SRC :=
  198. KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
  199. KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
  200. KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
  201. KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
  202. KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
  203. ifneq ("$(wildcard $(KEYBOARD_C_5))","")
  204. KEYBOARD_SRC += $(KEYBOARD_C_5)
  205. endif
  206. ifneq ("$(wildcard $(KEYBOARD_C_4))","")
  207. KEYBOARD_SRC += $(KEYBOARD_C_4)
  208. endif
  209. ifneq ("$(wildcard $(KEYBOARD_C_3))","")
  210. KEYBOARD_SRC += $(KEYBOARD_C_3)
  211. endif
  212. ifneq ("$(wildcard $(KEYBOARD_C_2))","")
  213. KEYBOARD_SRC += $(KEYBOARD_C_2)
  214. endif
  215. ifneq ("$(wildcard $(KEYBOARD_C_1))","")
  216. KEYBOARD_SRC += $(KEYBOARD_C_1)
  217. endif
  218. # Generate KEYBOARD_name_subname for all levels of the keyboard folder
  219. KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
  220. KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
  221. KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
  222. KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
  223. KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
  224. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  225. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
  226. endif
  227. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  228. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
  229. endif
  230. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  231. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
  232. endif
  233. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  234. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
  235. endif
  236. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  237. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
  238. endif
  239. # Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
  240. # that the same keymap may be used on multiple keyboards.
  241. #
  242. # We grab the most top-level include file that we can. That file should
  243. # use #ifdef statements to include all the necessary subfolder includes,
  244. # as described here:
  245. #
  246. # https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
  247. #
  248. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
  249. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
  250. endif
  251. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
  252. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
  253. endif
  254. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
  255. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
  256. endif
  257. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
  258. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
  259. endif
  260. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
  261. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
  262. endif
  263. # Find all of the config.h files and add them to our CONFIG_H define.
  264. CONFIG_H :=
  265. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
  266. CONFIG_H += $(KEYBOARD_PATH_5)/config.h
  267. endif
  268. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
  269. CONFIG_H += $(KEYBOARD_PATH_4)/config.h
  270. endif
  271. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
  272. CONFIG_H += $(KEYBOARD_PATH_3)/config.h
  273. endif
  274. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
  275. CONFIG_H += $(KEYBOARD_PATH_2)/config.h
  276. endif
  277. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
  278. CONFIG_H += $(KEYBOARD_PATH_1)/config.h
  279. endif
  280. POST_CONFIG_H :=
  281. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
  282. POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
  283. endif
  284. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
  285. POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
  286. endif
  287. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
  288. POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
  289. endif
  290. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
  291. POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
  292. endif
  293. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
  294. POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
  295. endif
  296. # Create dependencies on DD keyboard config - structure validated elsewhere
  297. DD_CONFIG_FILES :=
  298. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
  299. DD_CONFIG_FILES += $(KEYBOARD_PATH_1)/info.json
  300. endif
  301. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
  302. DD_CONFIG_FILES += $(KEYBOARD_PATH_2)/info.json
  303. endif
  304. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
  305. DD_CONFIG_FILES += $(KEYBOARD_PATH_3)/info.json
  306. endif
  307. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
  308. DD_CONFIG_FILES += $(KEYBOARD_PATH_4)/info.json
  309. endif
  310. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
  311. DD_CONFIG_FILES += $(KEYBOARD_PATH_5)/info.json
  312. endif
  313. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/keyboard.json)","")
  314. DD_CONFIG_FILES += $(KEYBOARD_PATH_1)/keyboard.json
  315. endif
  316. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/keyboard.json)","")
  317. DD_CONFIG_FILES += $(KEYBOARD_PATH_2)/keyboard.json
  318. endif
  319. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/keyboard.json)","")
  320. DD_CONFIG_FILES += $(KEYBOARD_PATH_3)/keyboard.json
  321. endif
  322. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/keyboard.json)","")
  323. DD_CONFIG_FILES += $(KEYBOARD_PATH_4)/keyboard.json
  324. endif
  325. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/keyboard.json)","")
  326. DD_CONFIG_FILES += $(KEYBOARD_PATH_5)/keyboard.json
  327. endif
  328. CONFIG_H += $(INTERMEDIATE_OUTPUT)/src/info_config.h
  329. KEYBOARD_SRC += $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c
  330. $(INTERMEDIATE_OUTPUT)/src/info_config.h: $(DD_CONFIG_FILES)
  331. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  332. $(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/info_config.h)
  333. @$(BUILD_CMD)
  334. $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c: $(DD_CONFIG_FILES)
  335. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  336. $(eval CMD=$(QMK_BIN) generate-keyboard-c --quiet --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c)
  337. @$(BUILD_CMD)
  338. $(INTERMEDIATE_OUTPUT)/src/default_keyboard.h: $(DD_CONFIG_FILES)
  339. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  340. $(eval CMD=$(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --include $(FOUND_KEYBOARD_H) --output $(INTERMEDIATE_OUTPUT)/src/default_keyboard.h)
  341. @$(BUILD_CMD)
  342. generated-files: $(INTERMEDIATE_OUTPUT)/src/info_config.h $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c $(INTERMEDIATE_OUTPUT)/src/default_keyboard.h
  343. generated-files: $(INTERMEDIATE_OUTPUT)/src/info_deps.d
  344. $(INTERMEDIATE_OUTPUT)/src/info_deps.d:
  345. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  346. $(eval CMD=$(QMK_BIN) generate-make-dependencies -kb $(KEYBOARD) -km $(KEYMAP) -o $(INTERMEDIATE_OUTPUT)/src/info_deps.d)
  347. @$(BUILD_CMD)
  348. -include $(INTERMEDIATE_OUTPUT)/src/info_deps.d
  349. .INTERMEDIATE : generated-files
  350. # Userspace setup and definitions
  351. ifeq ("$(USER_NAME)","")
  352. USER_NAME := $(KEYMAP)
  353. endif
  354. USER_PATH := users/$(USER_NAME)
  355. # If we have userspace, then add it to the lookup VPATH
  356. ifneq ($(wildcard $(QMK_USERSPACE)),)
  357. VPATH += $(QMK_USERSPACE)
  358. endif
  359. # If the equivalent users directory exists in userspace, use that in preference to anything currently in the main repo
  360. ifneq ($(wildcard $(QMK_USERSPACE)/$(USER_PATH)),)
  361. USER_PATH := $(QMK_USERSPACE)/$(USER_PATH)
  362. endif
  363. # Pull in user level rules.mk
  364. -include $(USER_PATH)/rules.mk
  365. ifneq ("$(wildcard $(USER_PATH)/config.h)","")
  366. CONFIG_H += $(USER_PATH)/config.h
  367. endif
  368. ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
  369. POST_CONFIG_H += $(USER_PATH)/post_config.h
  370. endif
  371. # Disable features that a keyboard doesn't support
  372. -include $(BUILDDEFS_PATH)/disable_features.mk
  373. ifneq ("$(CONVERTER)","")
  374. -include $(CONVERTER)/post_converter.mk
  375. endif
  376. # Pull in post_rules.mk files from all our subfolders
  377. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
  378. include $(KEYBOARD_PATH_1)/post_rules.mk
  379. endif
  380. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","")
  381. include $(KEYBOARD_PATH_2)/post_rules.mk
  382. endif
  383. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","")
  384. include $(KEYBOARD_PATH_3)/post_rules.mk
  385. endif
  386. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","")
  387. include $(KEYBOARD_PATH_4)/post_rules.mk
  388. endif
  389. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","")
  390. include $(KEYBOARD_PATH_5)/post_rules.mk
  391. endif
  392. ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
  393. CONFIG_H += $(KEYMAP_PATH)/config.h
  394. endif
  395. ifneq ("$(KEYMAP_H)","")
  396. CONFIG_H += $(KEYMAP_H)
  397. endif
  398. ifeq ($(KEYMAP_C),)
  399. $(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
  400. endif
  401. OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\"
  402. # If a keymap or userspace places their keymap array in another file instead, allow for it to be included
  403. # !!NOTE!! -- For this to work, the source file cannot be part of $(SRC), so users should not add it via `SRC += <file>`
  404. ifneq ($(strip $(INTROSPECTION_KEYMAP_C)),)
  405. OPT_DEFS += -DINTROSPECTION_KEYMAP_C=\"$(strip $(INTROSPECTION_KEYMAP_C))\"
  406. endif
  407. # project specific files
  408. SRC += \
  409. $(KEYBOARD_SRC) \
  410. $(QUANTUM_DIR)/keymap_introspection.c \
  411. $(QUANTUM_SRC) \
  412. $(QUANTUM_DIR)/main.c \
  413. # Optimize size but this may cause error "relocation truncated to fit"
  414. #EXTRALDFLAGS = -Wl,--relax
  415. # Search Path
  416. VPATH += $(KEYMAP_PATH)
  417. VPATH += $(USER_PATH)
  418. VPATH += $(KEYBOARD_PATHS)
  419. VPATH += $(COMMON_VPATH)
  420. VPATH += $(INTERMEDIATE_OUTPUT)/src
  421. include $(BUILDDEFS_PATH)/common_features.mk
  422. include $(BUILDDEFS_PATH)/generic_features.mk
  423. include $(TMK_PATH)/protocol.mk
  424. include $(PLATFORM_PATH)/common.mk
  425. SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
  426. SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
  427. -include $(PLATFORM_PATH)/$(PLATFORM_KEY)/bootloader.mk
  428. include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
  429. -include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
  430. ifneq ($(strip $(PROTOCOL)),)
  431. PROTOCOL_KEY = $(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]'))
  432. else
  433. PROTOCOL_KEY = $(PLATFORM_KEY)
  434. endif
  435. include $(TMK_PATH)/protocol/$(PROTOCOL_KEY)/$(PROTOCOL_KEY).mk
  436. # Setup definitions based on the selected MCU
  437. $(eval $(call add_qmk_prefix_defs,MCU_ORIG,MCU))
  438. $(eval $(call add_qmk_prefix_defs,MCU_ARCH,MCU_ARCH))
  439. $(eval $(call add_qmk_prefix_defs,MCU_PORT_NAME,MCU_PORT_NAME))
  440. $(eval $(call add_qmk_prefix_defs,MCU_FAMILY,MCU_FAMILY))
  441. $(eval $(call add_qmk_prefix_defs,MCU_SERIES,MCU_SERIES))
  442. $(eval $(call add_qmk_prefix_defs,BOARD,BOARD))
  443. $(eval $(call add_qmk_prefix_defs,OPT,OPT))
  444. # Control whether intermediate file listings are generated
  445. # e.g.:
  446. # make handwired/onekey/blackpill_f411:default KEEP_INTERMEDIATES=yes
  447. # cat .build/obj_handwired_onekey_blackpill_f411_default/quantum/quantum.i | sed -e 's@^#.*@@g' -e 's@^\s*//.*@@g' -e '/^\s*$/d' | clang-format
  448. ifeq ($(strip $(KEEP_INTERMEDIATES)), yes)
  449. OPT_DEFS += -save-temps=obj
  450. endif
  451. OUTPUTS := $(INTERMEDIATE_OUTPUT)
  452. $(INTERMEDIATE_OUTPUT)_SRC := $(SRC) $(PLATFORM_SRC)
  453. $(INTERMEDIATE_OUTPUT)_DEFS := \
  454. -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(INTERMEDIATE_OUTPUT)/src/default_keyboard.h\" \
  455. -DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\" \
  456. $(OPT_DEFS)
  457. $(INTERMEDIATE_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
  458. $(INTERMEDIATE_OUTPUT)_CONFIG := $(CONFIG_H) $(POST_CONFIG_H)
  459. # Default target.
  460. all: build check-size
  461. build: elf cpfirmware
  462. check-size: build
  463. check-md5: build
  464. objs-size: build
  465. ifneq ($(strip $(TOP_SYMBOLS)),)
  466. ifeq ($(strip $(TOP_SYMBOLS)),yes)
  467. NUM_TOP_SYMBOLS := 10
  468. else
  469. NUM_TOP_SYMBOLS := $(strip $(TOP_SYMBOLS))
  470. endif
  471. all: top-symbols
  472. check-size: top-symbols
  473. top-symbols: build
  474. echo "###########################################"
  475. echo "# Highest flash usage:"
  476. $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep ' [RrTt] ' | head -n$(NUM_TOP_SYMBOLS) | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g'
  477. echo "###########################################"
  478. echo "# Highest RAM usage:"
  479. $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep ' [BbCDdGgSs] ' | head -n$(NUM_TOP_SYMBOLS) | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g'
  480. echo "###########################################"
  481. endif
  482. include $(BUILDDEFS_PATH)/show_options.mk
  483. include $(BUILDDEFS_PATH)/common_rules.mk
  484. # Ensure we have generated files available for each of the objects
  485. define GEN_FILES
  486. $1: generated-files
  487. endef
  488. $(foreach O,$(OBJ),$(eval $(call GEN_FILES,$(patsubst %.a,%.o,$(O)))))