Skip to content

Commit ad140e1

Browse files
fauxparknicocesar
authored andcommitted
Kiibohd bootloader, take 2 (qmk#10129)
1 parent b98949e commit ad140e1

File tree

12 files changed

+28
-74
lines changed

12 files changed

+28
-74
lines changed

bootloader.mk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# qmk-dfu QMK DFU (LUFA + blinkenlight)
2828
# bootloadHID HIDBootFlash compatible (ATmega32A)
2929
# USBasp USBaspLoader (ATmega328P)
30+
# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
3031
#
3132
# BOOTLOADER_SIZE can still be defined manually, but it's recommended
3233
# you add any possible configuration to this list
@@ -89,7 +90,19 @@ ifeq ($(strip $(BOOTLOADER)), lufa-ms)
8990
BOOTLOADER_SIZE = 6144
9091
FIRMWARE_FORMAT = bin
9192
endif
92-
9393
ifdef BOOTLOADER_SIZE
9494
OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
9595
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

keyboards/ergodox_infinity/bootloader_defs.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

keyboards/ergodox_infinity/rules.mk

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
# MCU name
22
MCU = MK20DX256
33

4-
# Linker script to use
5-
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
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
4+
# Bootloader selection
5+
BOOTLOADER = kiibohd
176

187
# Build Options
198
# comment out to disable the options.
209
#
21-
22-
DFU_ARGS = -d 1c11:b007
23-
DFU_SUFFIX_ARGS = -p b007 -v 1c11
24-
2510
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
2611
MOUSEKEY_ENABLE = yes # Mouse keys
2712
EXTRAKEY_ENABLE = yes # Audio control and System control

keyboards/infinity60/bootloader_defs.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

keyboards/infinity60/rules.mk

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
# MCU name
22
MCU = MK20DX128
33

4-
# Linker script to use
5-
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
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
4+
# Bootloader selection
5+
BOOTLOADER = kiibohd
146

157
# Board: it should exist either in <chibios>/os/hal/boards/
168
# or <this_dir>/boards
@@ -21,15 +13,9 @@ MCU_LDSCRIPT = MK20DX128BLDR4
2113
# - MCHCK_K20 for Infinity KB
2214
BOARD = MCHCK_K20
2315

24-
BOOTLOADER = dfu
25-
2616
# Build Options
2717
# comment out to disable the options.
2818
#
29-
30-
DFU_ARGS = -d 1c11:b007
31-
DFU_SUFFIX_ARGS = -p b007 -v 1c11
32-
3319
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
3420
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
3521
MOUSEKEY_ENABLE = yes # Mouse keys

keyboards/k_type/bootloader_defs.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

keyboards/k_type/rules.mk

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,15 @@
11
# MCU name
22
MCU = MK20DX256
33

4-
# Linker script to use
5-
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
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
4+
# Bootloader selection
5+
BOOTLOADER = kiibohd
156

167
# Board: it should exist either in <chibios>/os/hal/boards/
178
# or <this_dir>/boards
189
# This board was copied from PJRC_TEENSY_3_1. The only difference should be a
1910
# hack to ensure the watchdog has started before trying to disable it.
2011
BOARD = IC_TEENSY_3_1
2112

22-
DFU_ARGS = -d 1c11:b007
23-
DFU_SUFFIX_ARGS = -p b007 -v 1c11
24-
25-
BOOTLOADER = dfu
26-
2713
# Build Options
2814
# comment out to disable the options.
2915
#

keyboards/whitefox/bootloader_defs.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

keyboards/whitefox/rules.mk

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
# MCU name
22
MCU = MK20DX256
33

4-
# Linker script to use
5-
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
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
4+
# Bootloader selection
5+
BOOTLOADER = kiibohd
156

167
# Board: it should exist either in <chibios>/os/hal/boards/
178
# or <this_dir>/boards
@@ -22,11 +13,6 @@ MCU_LDSCRIPT = MK20DX256BLDR8
2213
# - MCHCK_K20 for Infinity KB
2314
BOARD = IC_TEENSY_3_1
2415

25-
DFU_ARGS = -d 1c11:b007
26-
DFU_SUFFIX_ARGS = -p b007 -v 1c11
27-
28-
BOOTLOADER = dfu
29-
3016
# Build Options
3117
# comment out to disable the options.
3218
#

quantum/mcu_selection.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
MCU_ORIG := $(MCU)
2+
13
ifneq ($(findstring MKL26Z64, $(MCU)),)
24
# Cortex version
35
MCU = cortex-m0plus

tmk_core/chibios.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ bin: $(BUILD_DIR)/$(TARGET).bin sizeafter
386386
flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
387387
ifneq ($(strip $(PROGRAM_CMD)),)
388388
$(PROGRAM_CMD)
389-
else ifeq ($(strip $(BOOTLOADER)),dfu)
389+
else ifeq ($(strip $(BOOTLOADER)),kiibohd)
390390
$(call EXEC_DFU_UTIL)
391391
else ifeq ($(strip $(MCU_FAMILY)),KINETIS)
392392
$(call EXEC_TEENSY)

tmk_core/common/chibios/bootloader.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void enter_bootloader_mode_if_requested(void) {
8282
#elif defined(KL2x) || defined(K20x) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS
8383
/* Kinetis */
8484

85-
# if defined(KIIBOHD_BOOTLOADER)
85+
# if defined(BOOTLOADER_KIIBOHD)
8686
/* Kiibohd Bootloader (MCHCK and Infinity KB) */
8787
# define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000
8888
const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff";
@@ -92,14 +92,14 @@ void bootloader_jump(void) {
9292
SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk;
9393
}
9494

95-
# else /* defined(KIIBOHD_BOOTLOADER) */
95+
# else /* defined(BOOTLOADER_KIIBOHD) */
9696
/* Default for Kinetis - expecting an ARM Teensy */
9797
# include "wait.h"
9898
void bootloader_jump(void) {
9999
wait_ms(100);
100100
__BKPT(0);
101101
}
102-
# endif /* defined(KIIBOHD_BOOTLOADER) */
102+
# endif /* defined(BOOTLOADER_KIIBOHD) */
103103

104104
#else /* neither STM32 nor KINETIS */
105105
__attribute__((weak)) void bootloader_jump(void) {}

0 commit comments

Comments
 (0)