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.

520 lines
18 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
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
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
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
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
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. KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
  25. # Force expansion
  26. TARGET := $(TARGET)
  27. ifneq ($(FORCE_LAYOUT),)
  28. TARGET := $(TARGET)_$(FORCE_LAYOUT)
  29. endif
  30. # Object files and generated keymap directory
  31. # To put object files in current directory, use a dot (.), do NOT make
  32. # this an empty or blank macro!
  33. KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
  34. ifdef SKIP_VERSION
  35. OPT_DEFS += -DSKIP_VERSION
  36. endif
  37. # Generate the version.h file
  38. VERSION_H_FLAGS :=
  39. ifdef SKIP_VERSION
  40. VERSION_H_FLAGS += --skip-all
  41. endif
  42. ifdef SKIP_GIT
  43. VERSION_H_FLAGS += --skip-git
  44. endif
  45. # Generate the board's version.h file.
  46. $(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)
  47. # Determine which subfolders exist.
  48. KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
  49. KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
  50. KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
  51. KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
  52. KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
  53. KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
  54. KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
  55. KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
  56. KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
  57. KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
  58. KEYBOARD_PATHS :=
  59. KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
  60. KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
  61. KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
  62. KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
  63. KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
  64. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  65. KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
  66. endif
  67. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  68. KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
  69. endif
  70. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  71. KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
  72. endif
  73. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  74. KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
  75. endif
  76. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  77. KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
  78. endif
  79. # Pull in rules.mk files from all our subfolders
  80. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
  81. include $(KEYBOARD_PATH_5)/rules.mk
  82. endif
  83. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
  84. include $(KEYBOARD_PATH_4)/rules.mk
  85. endif
  86. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
  87. include $(KEYBOARD_PATH_3)/rules.mk
  88. endif
  89. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
  90. include $(KEYBOARD_PATH_2)/rules.mk
  91. endif
  92. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
  93. include $(KEYBOARD_PATH_1)/rules.mk
  94. endif
  95. MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
  96. MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
  97. MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
  98. MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
  99. MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
  100. # Pull in rules from info.json
  101. INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk)
  102. include $(INFO_RULES_MK)
  103. # Check for keymap.json first, so we can regenerate keymap.c
  104. include $(BUILDDEFS_PATH)/build_json.mk
  105. # Pull in keymap level rules.mk
  106. ifeq ("$(wildcard $(KEYMAP_PATH))", "")
  107. # Look through the possible keymap folders until we find a matching keymap.c
  108. ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
  109. -include $(MAIN_KEYMAP_PATH_1)/rules.mk
  110. KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
  111. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
  112. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
  113. -include $(MAIN_KEYMAP_PATH_2)/rules.mk
  114. KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
  115. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
  116. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
  117. -include $(MAIN_KEYMAP_PATH_3)/rules.mk
  118. KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
  119. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
  120. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
  121. -include $(MAIN_KEYMAP_PATH_4)/rules.mk
  122. KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
  123. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
  124. else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
  125. -include $(MAIN_KEYMAP_PATH_5)/rules.mk
  126. KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
  127. KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
  128. else ifneq ($(LAYOUTS),)
  129. # If we haven't found a keymap yet fall back to community layouts
  130. include $(BUILDDEFS_PATH)/build_layout.mk
  131. else
  132. $(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
  133. # this state should never be reached
  134. endif
  135. endif
  136. # Have we found a keymap.json?
  137. ifneq ("$(wildcard $(KEYMAP_JSON))", "")
  138. KEYMAP_C := $(KEYMAP_OUTPUT)/src/keymap.c
  139. KEYMAP_H := $(KEYMAP_OUTPUT)/src/config.h
  140. # Load the keymap-level rules.mk if exists
  141. -include $(KEYMAP_PATH)/rules.mk
  142. # Load any rules.mk content from keymap.json
  143. INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --output $(KEYMAP_OUTPUT)/src/rules.mk $(KEYMAP_JSON))
  144. include $(INFO_RULES_MK)
  145. # Add rules to generate the keymap files - indentation here is important
  146. $(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
  147. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  148. $(eval CMD=$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON))
  149. @$(BUILD_CMD)
  150. $(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON)
  151. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  152. $(eval CMD=$(QMK_BIN) generate-config-h --quiet --output $(KEYMAP_H) $(KEYMAP_JSON))
  153. @$(BUILD_CMD)
  154. generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
  155. endif
  156. include $(BUILDDEFS_PATH)/converters.mk
  157. include $(BUILDDEFS_PATH)/mcu_selection.mk
  158. # Find all the C source files to be compiled in subfolders.
  159. KEYBOARD_SRC :=
  160. KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
  161. KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
  162. KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
  163. KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
  164. KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
  165. ifneq ("$(wildcard $(KEYBOARD_C_5))","")
  166. KEYBOARD_SRC += $(KEYBOARD_C_5)
  167. endif
  168. ifneq ("$(wildcard $(KEYBOARD_C_4))","")
  169. KEYBOARD_SRC += $(KEYBOARD_C_4)
  170. endif
  171. ifneq ("$(wildcard $(KEYBOARD_C_3))","")
  172. KEYBOARD_SRC += $(KEYBOARD_C_3)
  173. endif
  174. ifneq ("$(wildcard $(KEYBOARD_C_2))","")
  175. KEYBOARD_SRC += $(KEYBOARD_C_2)
  176. endif
  177. ifneq ("$(wildcard $(KEYBOARD_C_1))","")
  178. KEYBOARD_SRC += $(KEYBOARD_C_1)
  179. endif
  180. # Generate KEYBOARD_name_subname for all levels of the keyboard folder
  181. KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
  182. KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
  183. KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
  184. KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
  185. KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
  186. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
  187. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
  188. endif
  189. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
  190. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
  191. endif
  192. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
  193. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
  194. endif
  195. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
  196. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
  197. endif
  198. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
  199. OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
  200. endif
  201. # Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
  202. # that the same keymap may be used on multiple keyboards.
  203. #
  204. # We grab the most top-level include file that we can. That file should
  205. # use #ifdef statements to include all the necessary subfolder includes,
  206. # as described here:
  207. #
  208. # https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
  209. #
  210. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
  211. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
  212. endif
  213. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
  214. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
  215. endif
  216. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
  217. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
  218. endif
  219. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
  220. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
  221. endif
  222. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
  223. FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
  224. endif
  225. # Determine and set parameters based on the keyboard's processor family.
  226. # We can assume a ChibiOS target When MCU_FAMILY is defined since it's
  227. # not used for LUFA
  228. ifdef MCU_FAMILY
  229. PLATFORM=CHIBIOS
  230. PLATFORM_KEY=chibios
  231. FIRMWARE_FORMAT?=bin
  232. OPT_DEFS += -DMCU_$(MCU_FAMILY)
  233. else ifdef ARM_ATSAM
  234. PLATFORM=ARM_ATSAM
  235. PLATFORM_KEY=arm_atsam
  236. FIRMWARE_FORMAT=bin
  237. else
  238. PLATFORM=AVR
  239. PLATFORM_KEY=avr
  240. FIRMWARE_FORMAT?=hex
  241. endif
  242. # Find all of the config.h files and add them to our CONFIG_H define.
  243. CONFIG_H :=
  244. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
  245. CONFIG_H += $(KEYBOARD_PATH_5)/config.h
  246. endif
  247. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
  248. CONFIG_H += $(KEYBOARD_PATH_4)/config.h
  249. endif
  250. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
  251. CONFIG_H += $(KEYBOARD_PATH_3)/config.h
  252. endif
  253. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
  254. CONFIG_H += $(KEYBOARD_PATH_2)/config.h
  255. endif
  256. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
  257. CONFIG_H += $(KEYBOARD_PATH_1)/config.h
  258. endif
  259. POST_CONFIG_H :=
  260. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
  261. POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
  262. endif
  263. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
  264. POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
  265. endif
  266. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
  267. POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
  268. endif
  269. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
  270. POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
  271. endif
  272. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
  273. POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
  274. endif
  275. # Pull in stuff from info.json
  276. INFO_JSON_FILES :=
  277. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
  278. INFO_JSON_FILES += $(KEYBOARD_PATH_1)/info.json
  279. endif
  280. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
  281. INFO_JSON_FILES += $(KEYBOARD_PATH_2)/info.json
  282. endif
  283. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
  284. INFO_JSON_FILES += $(KEYBOARD_PATH_3)/info.json
  285. endif
  286. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
  287. INFO_JSON_FILES += $(KEYBOARD_PATH_4)/info.json
  288. endif
  289. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
  290. INFO_JSON_FILES += $(KEYBOARD_PATH_5)/info.json
  291. endif
  292. CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h
  293. KEYBOARD_SRC += $(KEYBOARD_OUTPUT)/src/default_keyboard.c
  294. $(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
  295. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  296. $(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h)
  297. @$(BUILD_CMD)
  298. $(KEYBOARD_OUTPUT)/src/default_keyboard.c: $(INFO_JSON_FILES)
  299. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  300. $(eval CMD=$(QMK_BIN) generate-keyboard-c --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.c)
  301. @$(BUILD_CMD)
  302. $(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES)
  303. @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
  304. $(eval CMD=$(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --include $(FOUND_KEYBOARD_H) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h)
  305. @$(BUILD_CMD)
  306. generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.c $(KEYBOARD_OUTPUT)/src/default_keyboard.h
  307. .INTERMEDIATE : generated-files
  308. # Userspace setup and definitions
  309. ifeq ("$(USER_NAME)","")
  310. USER_NAME := $(KEYMAP)
  311. endif
  312. USER_PATH := users/$(USER_NAME)
  313. # Pull in user level rules.mk
  314. -include $(USER_PATH)/rules.mk
  315. ifneq ("$(wildcard $(USER_PATH)/config.h)","")
  316. CONFIG_H += $(USER_PATH)/config.h
  317. endif
  318. ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
  319. POST_CONFIG_H += $(USER_PATH)/post_config.h
  320. endif
  321. # Disable features that a keyboard doesn't support
  322. -include $(BUILDDEFS_PATH)/disable_features.mk
  323. ifneq ("$(CONVERTER)","")
  324. -include $(CONVERTER)/post_converter.mk
  325. endif
  326. # Pull in post_rules.mk files from all our subfolders
  327. ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
  328. include $(KEYBOARD_PATH_1)/post_rules.mk
  329. endif
  330. ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","")
  331. include $(KEYBOARD_PATH_2)/post_rules.mk
  332. endif
  333. ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","")
  334. include $(KEYBOARD_PATH_3)/post_rules.mk
  335. endif
  336. ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","")
  337. include $(KEYBOARD_PATH_4)/post_rules.mk
  338. endif
  339. ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","")
  340. include $(KEYBOARD_PATH_5)/post_rules.mk
  341. endif
  342. ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
  343. CONFIG_H += $(KEYMAP_PATH)/config.h
  344. endif
  345. ifneq ("$(KEYMAP_H)","")
  346. CONFIG_H += $(KEYMAP_H)
  347. endif
  348. OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\"
  349. # If a keymap or userspace places their keymap array in another file instead, allow for it to be included
  350. # !!NOTE!! -- For this to work, the source file cannot be part of $(SRC), so users should not add it via `SRC += <file>`
  351. ifneq ($(strip $(INTROSPECTION_KEYMAP_C)),)
  352. OPT_DEFS += -DINTROSPECTION_KEYMAP_C=\"$(strip $(INTROSPECTION_KEYMAP_C))\"
  353. endif
  354. # project specific files
  355. SRC += \
  356. $(KEYBOARD_SRC) \
  357. $(QUANTUM_DIR)/keymap_introspection.c \
  358. $(QUANTUM_SRC) \
  359. $(QUANTUM_DIR)/main.c \
  360. # Optimize size but this may cause error "relocation truncated to fit"
  361. #EXTRALDFLAGS = -Wl,--relax
  362. # Search Path
  363. VPATH += $(KEYMAP_PATH)
  364. VPATH += $(USER_PATH)
  365. VPATH += $(KEYBOARD_PATHS)
  366. VPATH += $(COMMON_VPATH)
  367. VPATH += $(KEYBOARD_OUTPUT)/src
  368. VPATH += $(KEYMAP_OUTPUT)/src
  369. include $(BUILDDEFS_PATH)/common_features.mk
  370. include $(BUILDDEFS_PATH)/generic_features.mk
  371. include $(TMK_PATH)/protocol.mk
  372. include $(PLATFORM_PATH)/common.mk
  373. SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
  374. SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
  375. SRC += $(TMK_COMMON_SRC)
  376. OPT_DEFS += $(TMK_COMMON_DEFS)
  377. EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
  378. SKIP_COMPILE := no
  379. ifneq ($(REQUIRE_PLATFORM_KEY),)
  380. ifneq ($(REQUIRE_PLATFORM_KEY),$(PLATFORM_KEY))
  381. SKIP_COMPILE := yes
  382. endif
  383. endif
  384. -include $(PLATFORM_PATH)/$(PLATFORM_KEY)/bootloader.mk
  385. include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
  386. -include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
  387. ifneq ($(strip $(PROTOCOL)),)
  388. include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
  389. else
  390. include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
  391. endif
  392. # Setup definitions based on the selected MCU
  393. $(eval $(call add_qmk_prefix_defs,MCU_ORIG,MCU))
  394. $(eval $(call add_qmk_prefix_defs,MCU_ARCH,MCU_ARCH))
  395. $(eval $(call add_qmk_prefix_defs,MCU_PORT_NAME,MCU_PORT_NAME))
  396. $(eval $(call add_qmk_prefix_defs,MCU_FAMILY,MCU_FAMILY))
  397. $(eval $(call add_qmk_prefix_defs,MCU_SERIES,MCU_SERIES))
  398. $(eval $(call add_qmk_prefix_defs,BOARD,BOARD))
  399. # TODO: remove this bodge?
  400. PROJECT_DEFS := $(OPT_DEFS)
  401. PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
  402. PROJECT_CONFIG := $(CONFIG_H)
  403. CONFIG_H += $(POST_CONFIG_H)
  404. ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
  405. OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
  406. $(KEYMAP_OUTPUT)_SRC := $(SRC)
  407. $(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) \
  408. -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(KEYBOARD_OUTPUT)/src/default_keyboard.h\" \
  409. -DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\"
  410. $(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
  411. $(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
  412. $(KEYBOARD_OUTPUT)_SRC := $(PLATFORM_SRC)
  413. $(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
  414. $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
  415. $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
  416. # Default target.
  417. ifeq ($(SKIP_COMPILE),no)
  418. all: build check-size
  419. else
  420. all:
  421. echo "skipped" >&2
  422. endif
  423. build: elf cpfirmware
  424. check-size: build
  425. check-md5: build
  426. objs-size: build
  427. ifneq ($(strip $(TOP_SYMBOLS)),)
  428. ifeq ($(strip $(TOP_SYMBOLS)),yes)
  429. NUM_TOP_SYMBOLS := 10
  430. else
  431. NUM_TOP_SYMBOLS := $(strip $(TOP_SYMBOLS))
  432. endif
  433. all: top-symbols
  434. check-size: top-symbols
  435. top-symbols: build
  436. echo "###########################################"
  437. echo "# Highest flash usage:"
  438. $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep -i ' [t] ' | 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'
  439. echo "###########################################"
  440. echo "# Highest RAM usage:"
  441. $(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep -i ' [dbv] ' | 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'
  442. echo "###########################################"
  443. endif
  444. include $(BUILDDEFS_PATH)/show_options.mk
  445. include $(BUILDDEFS_PATH)/common_rules.mk
  446. # Ensure we have generated files available for each of the objects
  447. define GEN_FILES
  448. $1: generated-files
  449. endef
  450. $(foreach O,$(OBJ),$(eval $(call GEN_FILES,$(patsubst %.a,%.o,$(O)))))