diff options
| author | Ryan <fauxpark@gmail.com> | 2020-08-25 18:58:00 +1000 |
|---|---|---|
| committer | James Young <18669334+noroadsleft@users.noreply.github.com> | 2020-08-29 14:30:02 -0700 |
| commit | b89b2030af655132e2708cbdffd7fb1b8e1aaeb4 (patch) | |
| tree | f6d9d65da2b9f93ce0ad2f6a9e00293a1c6f4aa5 | |
| parent | fa6cf8572736f16d2fe076c21546d08f258e145f (diff) | |
| download | qmk_firmware-b89b2030af655132e2708cbdffd7fb1b8e1aaeb4.tar.gz qmk_firmware-b89b2030af655132e2708cbdffd7fb1b8e1aaeb4.zip | |
Kiibohd bootloader, take 2 (#10129)
| -rw-r--r-- | bootloader.mk | 15 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/bootloader_defs.h | 1 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/rules.mk | 19 | ||||
| -rw-r--r-- | keyboards/infinity60/bootloader_defs.h | 1 | ||||
| -rw-r--r-- | keyboards/infinity60/rules.mk | 18 | ||||
| -rw-r--r-- | keyboards/k_type/bootloader_defs.h | 1 | ||||
| -rw-r--r-- | keyboards/k_type/rules.mk | 18 | ||||
| -rw-r--r-- | keyboards/whitefox/bootloader_defs.h | 1 | ||||
| -rw-r--r-- | keyboards/whitefox/rules.mk | 18 | ||||
| -rw-r--r-- | quantum/mcu_selection.mk | 2 | ||||
| -rw-r--r-- | tmk_core/chibios.mk | 2 | ||||
| -rw-r--r-- | tmk_core/common/chibios/bootloader.c | 6 |
12 files changed, 28 insertions, 74 deletions
diff --git a/bootloader.mk b/bootloader.mk index e516e9ff9..d5f803f89 100644 --- a/bootloader.mk +++ b/bootloader.mk | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | # qmk-dfu QMK DFU (LUFA + blinkenlight) | 27 | # qmk-dfu QMK DFU (LUFA + blinkenlight) |
| 28 | # bootloadHID HIDBootFlash compatible (ATmega32A) | 28 | # bootloadHID HIDBootFlash compatible (ATmega32A) |
| 29 | # USBasp USBaspLoader (ATmega328P) | 29 | # USBasp USBaspLoader (ATmega328P) |
| 30 | # kiibohd Input:Club Kiibohd bootloader (only used on their boards) | ||
| 30 | # | 31 | # |
| 31 | # BOOTLOADER_SIZE can still be defined manually, but it's recommended | 32 | # BOOTLOADER_SIZE can still be defined manually, but it's recommended |
| 32 | # you add any possible configuration to this list | 33 | # you add any possible configuration to this list |
| @@ -89,7 +90,19 @@ ifeq ($(strip $(BOOTLOADER)), lufa-ms) | |||
| 89 | BOOTLOADER_SIZE = 6144 | 90 | BOOTLOADER_SIZE = 6144 |
| 90 | FIRMWARE_FORMAT = bin | 91 | FIRMWARE_FORMAT = bin |
| 91 | endif | 92 | endif |
| 92 | |||
| 93 | ifdef BOOTLOADER_SIZE | 93 | ifdef BOOTLOADER_SIZE |
| 94 | OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE)) | 94 | OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE)) |
| 95 | endif | 95 | endif |
| 96 | |||
| 97 | ifeq ($(strip $(BOOTLOADER)), kiibohd) | ||
| 98 | OPT_DEFS += -DBOOTLOADER_KIIBOHD | ||
| 99 | ifeq ($(strip $(MCU_ORIG)), MK20DX128) | ||
| 100 | MCU_LDSCRIPT = MK20DX128BLDR4 | ||
| 101 | endif | ||
| 102 | ifeq ($(strip $(MCU_ORIG)), MK20DX256) | ||
| 103 | MCU_LDSCRIPT = MK20DX256BLDR8 | ||
| 104 | endif | ||
| 105 | |||
| 106 | DFU_ARGS = -d 1C11:B007 | ||
| 107 | DFU_SUFFIX_ARGS = -v 1C11 -p B007 | ||
| 108 | endif | ||
diff --git a/keyboards/ergodox_infinity/bootloader_defs.h b/keyboards/ergodox_infinity/bootloader_defs.h deleted file mode 100644 index c67153be6..000000000 --- a/keyboards/ergodox_infinity/bootloader_defs.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #define KIIBOHD_BOOTLOADER | ||
diff --git a/keyboards/ergodox_infinity/rules.mk b/keyboards/ergodox_infinity/rules.mk index 29e5c6dd7..b9ead9e87 100644 --- a/keyboards/ergodox_infinity/rules.mk +++ b/keyboards/ergodox_infinity/rules.mk | |||
| @@ -1,27 +1,12 @@ | |||
| 1 | # MCU name | 1 | # MCU name |
| 2 | MCU = MK20DX256 | 2 | MCU = MK20DX256 |
| 3 | 3 | ||
| 4 | # Linker script to use | 4 | # Bootloader selection |
| 5 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | 5 | BOOTLOADER = kiibohd |
| 6 | # or <this_dir>/ld/ | ||
| 7 | # - NOTE: a custom ld script is needed for EEPROM on Teensy LC | ||
| 8 | # - LDSCRIPT = | ||
| 9 | # - MKL26Z64 for Teensy LC | ||
| 10 | # - MK20DX128 for Teensy 3.0 | ||
| 11 | # - MK20DX256 for Teensy 3.1 and 3.2 | ||
| 12 | # - MK20DX128BLDR4 for Infinity 60% with Kiibohd bootloader | ||
| 13 | # - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader | ||
| 14 | MCU_LDSCRIPT = MK20DX256BLDR8 | ||
| 15 | |||
| 16 | BOOTLOADER = dfu | ||
| 17 | 6 | ||
| 18 | # Build Options | 7 | # Build Options |
| 19 | # comment out to disable the options. | 8 | # comment out to disable the options. |
| 20 | # | 9 | # |
| 21 | |||
| 22 | DFU_ARGS = -d 1c11:b007 | ||
| 23 | DFU_SUFFIX_ARGS = -p b007 -v 1c11 | ||
| 24 | |||
| 25 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | 10 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration |
| 26 | MOUSEKEY_ENABLE = yes # Mouse keys | 11 | MOUSEKEY_ENABLE = yes # Mouse keys |
| 27 | EXTRAKEY_ENABLE = yes # Audio control and System control | 12 | EXTRAKEY_ENABLE = yes # Audio control and System control |
diff --git a/keyboards/infinity60/bootloader_defs.h b/keyboards/infinity60/bootloader_defs.h deleted file mode 100644 index c67153be6..000000000 --- a/keyboards/infinity60/bootloader_defs.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #define KIIBOHD_BOOTLOADER | ||
diff --git a/keyboards/infinity60/rules.mk b/keyboards/infinity60/rules.mk index e6b234d82..dce10b571 100644 --- a/keyboards/infinity60/rules.mk +++ b/keyboards/infinity60/rules.mk | |||
| @@ -1,16 +1,8 @@ | |||
| 1 | # MCU name | 1 | # MCU name |
| 2 | MCU = MK20DX128 | 2 | MCU = MK20DX128 |
| 3 | 3 | ||
| 4 | # Linker script to use | 4 | # Bootloader selection |
| 5 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | 5 | BOOTLOADER = kiibohd |
| 6 | # or <this_dir>/ld/ | ||
| 7 | # - NOTE: a custom ld script is needed for EEPROM on Teensy LC | ||
| 8 | # - LDSCRIPT = | ||
| 9 | # - MKL26Z64 for Teensy LC | ||
| 10 | # - MK20DX128 for Teensy 3.0 | ||
| 11 | # - MK20DX256 for Teensy 3.1 and 3.2 | ||
| 12 | # - MK20DX128BLDR4 for Infinity with Kiibohd bootloader | ||
| 13 | MCU_LDSCRIPT = MK20DX128BLDR4 | ||
| 14 | 6 | ||
| 15 | # Board: it should exist either in <chibios>/os/hal/boards/ | 7 | # Board: it should exist either in <chibios>/os/hal/boards/ |
| 16 | # or <this_dir>/boards | 8 | # or <this_dir>/boards |
| @@ -21,15 +13,9 @@ MCU_LDSCRIPT = MK20DX128BLDR4 | |||
| 21 | # - MCHCK_K20 for Infinity KB | 13 | # - MCHCK_K20 for Infinity KB |
| 22 | BOARD = MCHCK_K20 | 14 | BOARD = MCHCK_K20 |
| 23 | 15 | ||
| 24 | BOOTLOADER = dfu | ||
| 25 | |||
| 26 | # Build Options | 16 | # Build Options |
| 27 | # comment out to disable the options. | 17 | # comment out to disable the options. |
| 28 | # | 18 | # |
| 29 | |||
| 30 | DFU_ARGS = -d 1c11:b007 | ||
| 31 | DFU_SUFFIX_ARGS = -p b007 -v 1c11 | ||
| 32 | |||
| 33 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | 19 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration |
| 34 | ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) | 20 | ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) |
| 35 | MOUSEKEY_ENABLE = yes # Mouse keys | 21 | MOUSEKEY_ENABLE = yes # Mouse keys |
diff --git a/keyboards/k_type/bootloader_defs.h b/keyboards/k_type/bootloader_defs.h deleted file mode 100644 index c67153be6..000000000 --- a/keyboards/k_type/bootloader_defs.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #define KIIBOHD_BOOTLOADER | ||
diff --git a/keyboards/k_type/rules.mk b/keyboards/k_type/rules.mk index 56c4c606e..52a9b8ee6 100644 --- a/keyboards/k_type/rules.mk +++ b/keyboards/k_type/rules.mk | |||
| @@ -1,17 +1,8 @@ | |||
| 1 | # MCU name | 1 | # MCU name |
| 2 | MCU = MK20DX256 | 2 | MCU = MK20DX256 |
| 3 | 3 | ||
| 4 | # Linker script to use | 4 | # Bootloader selection |
| 5 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | 5 | BOOTLOADER = kiibohd |
| 6 | # or <this_dir>/ld/ | ||
| 7 | # - NOTE: a custom ld script is needed for EEPROM on Teensy LC | ||
| 8 | # - LDSCRIPT = | ||
| 9 | # - MKL26Z64 for Teensy LC | ||
| 10 | # - MK20DX128 for Teensy 3.0 | ||
| 11 | # - MK20DX256 for Teensy 3.1 and 3.2 | ||
| 12 | # - MK20DX128BLDR4 for Infinity with Kiibohd bootloader | ||
| 13 | # - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader | ||
| 14 | MCU_LDSCRIPT = MK20DX256BLDR8 | ||
| 15 | 6 | ||
| 16 | # Board: it should exist either in <chibios>/os/hal/boards/ | 7 | # Board: it should exist either in <chibios>/os/hal/boards/ |
| 17 | # or <this_dir>/boards | 8 | # or <this_dir>/boards |
| @@ -19,11 +10,6 @@ MCU_LDSCRIPT = MK20DX256BLDR8 | |||
| 19 | # hack to ensure the watchdog has started before trying to disable it. | 10 | # hack to ensure the watchdog has started before trying to disable it. |
| 20 | BOARD = IC_TEENSY_3_1 | 11 | BOARD = IC_TEENSY_3_1 |
| 21 | 12 | ||
| 22 | DFU_ARGS = -d 1c11:b007 | ||
| 23 | DFU_SUFFIX_ARGS = -p b007 -v 1c11 | ||
| 24 | |||
| 25 | BOOTLOADER = dfu | ||
| 26 | |||
| 27 | # Build Options | 13 | # Build Options |
| 28 | # comment out to disable the options. | 14 | # comment out to disable the options. |
| 29 | # | 15 | # |
diff --git a/keyboards/whitefox/bootloader_defs.h b/keyboards/whitefox/bootloader_defs.h deleted file mode 100644 index c67153be6..000000000 --- a/keyboards/whitefox/bootloader_defs.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #define KIIBOHD_BOOTLOADER | ||
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk index 14507e9dd..c3621ebd1 100644 --- a/keyboards/whitefox/rules.mk +++ b/keyboards/whitefox/rules.mk | |||
| @@ -1,17 +1,8 @@ | |||
| 1 | # MCU name | 1 | # MCU name |
| 2 | MCU = MK20DX256 | 2 | MCU = MK20DX256 |
| 3 | 3 | ||
| 4 | # Linker script to use | 4 | # Bootloader selection |
| 5 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | 5 | BOOTLOADER = kiibohd |
| 6 | # or <this_dir>/ld/ | ||
| 7 | # - NOTE: a custom ld script is needed for EEPROM on Teensy LC | ||
| 8 | # - LDSCRIPT = | ||
| 9 | # - MKL26Z64 for Teensy LC | ||
| 10 | # - MK20DX128 for Teensy 3.0 | ||
| 11 | # - MK20DX256 for Teensy 3.1 and 3.2 | ||
| 12 | # - MK20DX128BLDR4 for Infinity with Kiibohd bootloader | ||
| 13 | # - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader | ||
| 14 | MCU_LDSCRIPT = MK20DX256BLDR8 | ||
| 15 | 6 | ||
| 16 | # Board: it should exist either in <chibios>/os/hal/boards/ | 7 | # Board: it should exist either in <chibios>/os/hal/boards/ |
| 17 | # or <this_dir>/boards | 8 | # or <this_dir>/boards |
| @@ -22,11 +13,6 @@ MCU_LDSCRIPT = MK20DX256BLDR8 | |||
| 22 | # - MCHCK_K20 for Infinity KB | 13 | # - MCHCK_K20 for Infinity KB |
| 23 | BOARD = IC_TEENSY_3_1 | 14 | BOARD = IC_TEENSY_3_1 |
| 24 | 15 | ||
| 25 | DFU_ARGS = -d 1c11:b007 | ||
| 26 | DFU_SUFFIX_ARGS = -p b007 -v 1c11 | ||
| 27 | |||
| 28 | BOOTLOADER = dfu | ||
| 29 | |||
| 30 | # Build Options | 16 | # Build Options |
| 31 | # comment out to disable the options. | 17 | # comment out to disable the options. |
| 32 | # | 18 | # |
diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk index 61fd7b6e4..33a0cabc8 100644 --- a/quantum/mcu_selection.mk +++ b/quantum/mcu_selection.mk | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | MCU_ORIG := $(MCU) | ||
| 2 | |||
| 1 | ifneq ($(findstring MKL26Z64, $(MCU)),) | 3 | ifneq ($(findstring MKL26Z64, $(MCU)),) |
| 2 | # Cortex version | 4 | # Cortex version |
| 3 | MCU = cortex-m0plus | 5 | MCU = cortex-m0plus |
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index a218488a1..2bd53f0dc 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk | |||
| @@ -386,7 +386,7 @@ bin: $(BUILD_DIR)/$(TARGET).bin sizeafter | |||
| 386 | flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter | 386 | flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter |
| 387 | ifneq ($(strip $(PROGRAM_CMD)),) | 387 | ifneq ($(strip $(PROGRAM_CMD)),) |
| 388 | $(PROGRAM_CMD) | 388 | $(PROGRAM_CMD) |
| 389 | else ifeq ($(strip $(BOOTLOADER)),dfu) | 389 | else ifeq ($(strip $(BOOTLOADER)),kiibohd) |
| 390 | $(call EXEC_DFU_UTIL) | 390 | $(call EXEC_DFU_UTIL) |
| 391 | else ifeq ($(strip $(MCU_FAMILY)),KINETIS) | 391 | else ifeq ($(strip $(MCU_FAMILY)),KINETIS) |
| 392 | $(call EXEC_TEENSY) | 392 | $(call EXEC_TEENSY) |
diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index 743448ee1..7b2cf5c43 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c | |||
| @@ -82,7 +82,7 @@ void enter_bootloader_mode_if_requested(void) { | |||
| 82 | #elif defined(KL2x) || defined(K20x) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS | 82 | #elif defined(KL2x) || defined(K20x) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS |
| 83 | /* Kinetis */ | 83 | /* Kinetis */ |
| 84 | 84 | ||
| 85 | # if defined(KIIBOHD_BOOTLOADER) | 85 | # if defined(BOOTLOADER_KIIBOHD) |
| 86 | /* Kiibohd Bootloader (MCHCK and Infinity KB) */ | 86 | /* Kiibohd Bootloader (MCHCK and Infinity KB) */ |
| 87 | # define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 | 87 | # define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 |
| 88 | const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; | 88 | const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; |
| @@ -92,14 +92,14 @@ void bootloader_jump(void) { | |||
| 92 | SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; | 92 | SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | # else /* defined(KIIBOHD_BOOTLOADER) */ | 95 | # else /* defined(BOOTLOADER_KIIBOHD) */ |
| 96 | /* Default for Kinetis - expecting an ARM Teensy */ | 96 | /* Default for Kinetis - expecting an ARM Teensy */ |
| 97 | # include "wait.h" | 97 | # include "wait.h" |
| 98 | void bootloader_jump(void) { | 98 | void bootloader_jump(void) { |
| 99 | wait_ms(100); | 99 | wait_ms(100); |
| 100 | __BKPT(0); | 100 | __BKPT(0); |
| 101 | } | 101 | } |
| 102 | # endif /* defined(KIIBOHD_BOOTLOADER) */ | 102 | # endif /* defined(BOOTLOADER_KIIBOHD) */ |
| 103 | 103 | ||
| 104 | #else /* neither STM32 nor KINETIS */ | 104 | #else /* neither STM32 nor KINETIS */ |
| 105 | __attribute__((weak)) void bootloader_jump(void) {} | 105 | __attribute__((weak)) void bootloader_jump(void) {} |
