Skip to content

Commit

Permalink
fixs #164, speeds up dfu reset
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhumbert committed Nov 21, 2017
1 parent 54f4201 commit 9ab3aeb
Show file tree
Hide file tree
Showing 45 changed files with 203 additions and 181 deletions.
62 changes: 62 additions & 0 deletions bootloader.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2017 Jack Humbert
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# If it's possible that multiple bootloaders can be used for one project,
# you can leave this unset, and the correct size will be selected
# automatically.
#
# Sets the bootloader defined in the keyboard's/keymap's rules.mk
# Current options:
# atmel-dfu
# lufa-dfu
# qmk-dfu
# halfkay
# caterina
# bootloadHID
#
# BOOTLOADER_SIZE can still be defined manually, but it's recommended
# you add any possible configuration to this list

ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
OPT_DEFS += -DBOOTLOADER_DFU
BOOTLOADER_SIZE = 2048
endif
ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
OPT_DEFS += -DBOOTLOADER_LUFA_DFU
OPT_DEFS += -DBOOTLOADER_DFU
BOOTLOADER_SIZE = 2048
endif
ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
OPT_DEFS += -DBOOTLOADER_QMK_DFU
OPT_DEFS += -DBOOTLOADER_DFU
BOOTLOADER_SIZE = 2048
endif
ifeq ($(strip $(BOOTLOADER)), halfkay)
OPT_DEFS += -DBOOTLOADER_HALFKAY
BOOTLOADER_SIZE = 512
endif
ifeq ($(strip $(BOOTLOADER)), caterina)
OPT_DEFS += -DBOOTLOADER_CATERINA
BOOTLOADER_SIZE = 2048
endif
ifeq ($(strip $(BOOTLOADER)), bootloadHID)
OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
BOOTLOADER_SIZE = 2048
endif

ifdef BOOTLOADER_SIZE
OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
endif
1 change: 1 addition & 0 deletions build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ VPATH += $(USER_PATH)
include common_features.mk
include $(TMK_PATH)/protocol.mk
include $(TMK_PATH)/common.mk
include bootloader.mk

SRC += $(TMK_COMMON_SRC)
OPT_DEFS += $(TMK_COMMON_DEFS)
Expand Down
2 changes: 1 addition & 1 deletion docs/flashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Arduino boards and their clones use the [Caterina bootloader](https://github.com

This block of code allows for Caterina compatibility in QMK:

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

These bootloaders are usually 4096 bytes for the atmega32u4 chip.

Expand Down
2 changes: 1 addition & 1 deletion keyboards/atreus/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ifdef TEENSY2
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
OPT_DEFS += -DATREUS_ASTAR
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
Expand Down
2 changes: 1 addition & 1 deletion keyboards/atreus62/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D2, D3, D1, D0, D4 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, C6 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bfake/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_ANIMATIONS

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bmini/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_ANIMATIONS

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
Expand Down
2 changes: 1 addition & 1 deletion keyboards/chimera_ortho/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)

Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/ble/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BLUETOOTH = AdafruitBLE
ADAFRUIT_BLE_ENABLE = yes
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
F_CPU = 8000000
2 changes: 1 addition & 1 deletion keyboards/deltasplit75/v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
2 changes: 1 addition & 1 deletion keyboards/dichotemy/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

OPT_DEFS += -DDICHOTEMY_PROMICRO
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
DICHOTEMY_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)

Expand Down
2 changes: 1 addition & 1 deletion keyboards/eco/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 4
#define MATRIX_COLS 14

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
6 changes: 6 additions & 0 deletions keyboards/ergodox_ez/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)

# Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, leave this blank, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options.
BOOTLOADER = halfkay

# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT

Expand Down
2 changes: 1 addition & 1 deletion keyboards/gherkin/keymaps/mjt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { F7, B1, B3, B2, B6 }
#define MATRIX_COL_PINS { B4, E6, D7, F6, D4, D0 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

#define UNUSED_PINS

Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/MS_sculpt_mobile/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SRC= babblePaste.c
ifdef ASTAR
CFLAGS=-D ASTAR
MCU = atmega32u4
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
SCULPT_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done ; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)

Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/reddot/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ifdef TEENSY2
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
OPT_DEFS += -DATREUS_ASTAR
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/space_oddity/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define PRODUCT Space Odyssey
#define DESCRIPTION Keyboard

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

#define MOUSEKEY_INTERVAL 16
#define MOUSEKEY_DELAY 0
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/traveller/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ifdef TEENSY2
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
OPT_DEFS += -DATREUS_ASTAR
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/woodpad/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
Expand Down
2 changes: 1 addition & 1 deletion keyboards/iris/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
2 changes: 1 addition & 1 deletion keyboards/iris/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D7, E6, B4, D2, D4 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
2 changes: 1 addition & 1 deletion keyboards/jj40/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_TOGGLE 3

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
Expand Down
2 changes: 1 addition & 1 deletion keyboards/lets_split/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MATRIX_COL_PINS { B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order


#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
Expand Down
2 changes: 1 addition & 1 deletion keyboards/lets_split/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
// #define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6 } //uncomment this line and comment line above if you need to reverse left-to-right key order

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
Expand Down
2 changes: 1 addition & 1 deletion keyboards/lets_split/sockets/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F4, F7, D7, B3, B2, B6}
// #define MATRIX_COL_PINS { B6, B2, B3, C6, F7, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
Expand Down
2 changes: 1 addition & 1 deletion keyboards/levinson/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
Expand Down
2 changes: 1 addition & 1 deletion keyboards/levinson/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }


#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mechmini/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_DI_PIN E2

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
Expand Down
2 changes: 1 addition & 1 deletion keyboards/minidox/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { B2, B6, B4, B5 }
#define MATRIX_COL_PINS { F4, D3, D2, D1, D4 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

#define USE_SERIAL

Expand Down
2 changes: 1 addition & 1 deletion keyboards/mitosis/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

OPT_DEFS += -DMITOSIS_PROMICRO
OPT_DEFS += -DCATERINA_BOOTLOADER
OPT_DEFS += -DBOOTLOADER_CATERINA
MITOSIS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)

Expand Down
2 changes: 1 addition & 1 deletion keyboards/mt40/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_VAL_STEP 18

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

#define TAPPING_TERM 200

Expand Down
2 changes: 1 addition & 1 deletion keyboards/nyquist/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
2 changes: 1 addition & 1 deletion keyboards/orthodox/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { D2, F5, F6, F7, B6, B5, B4, D7, D6 }
/*/

#define CATERINA_BOOTLOADER
#define BOOTLOADER_CATERINA

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
Expand Down
2 changes: 1 addition & 1 deletion keyboards/pearl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION 40% keyboard

#define NO_UART 1
#define BOOTLOADHID_BOOTLOADER 1
#define BOOTLOADER_BOOTLOADHID 1

#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 12
Expand Down
6 changes: 6 additions & 0 deletions keyboards/planck/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)

# Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, leave this blank, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options.
BOOTLOADER = qmk-dfu

# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT

Expand Down
Loading

0 comments on commit 9ab3aeb

Please sign in to comment.