aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-11-27 23:08:21 -0500
committerGitHub <noreply@github.com>2017-11-27 23:08:21 -0500
commit9fdc27626097ae03b767a09427efc90475d90955 (patch)
treea555c38f1b714af6e2c2c96187552757d08224b9
parent9113f3387a670373919fe62899b0ab27e9d89eba (diff)
downloadqmk_firmware-9fdc27626097ae03b767a09427efc90475d90955.tar.gz
qmk_firmware-9fdc27626097ae03b767a09427efc90475d90955.zip
Updates bootloader settings, adds file size check (#2029)
* pull fuse settings for bootloader jump * fix 32a chips * make automatic bootloader selection optional * quantify bootloaders * fixs #164, speeds up dfu reset * fix for chips w/o usb * missing an n * fix bootloader sizes, use words for addresses * fix bmini, pearl, and [[ issue, make things quiet * ignore avr errors on arm for now * update settings for the light * document bootloader stuff * add bootloader title
-rw-r--r--bootloader.mk62
-rw-r--r--build_keyboard.mk5
-rw-r--r--docs/flashing.md45
-rw-r--r--keyboards/atreus/rules.mk21
-rw-r--r--keyboards/atreus62/config.h2
-rw-r--r--keyboards/atreus62/rules.mk15
-rw-r--r--keyboards/bfake/config.h1
-rw-r--r--keyboards/bfake/rules.mk7
-rw-r--r--keyboards/bmini/config.h1
-rw-r--r--keyboards/bmini/rules.mk7
-rw-r--r--keyboards/chimera_ortho/rules.mk17
-rw-r--r--keyboards/converter/usb_usb/ble/rules.mk1
-rw-r--r--keyboards/converter/usb_usb/rules.mk16
-rw-r--r--keyboards/deltasplit75/rules.mk15
-rw-r--r--keyboards/deltasplit75/v2/config.h2
-rw-r--r--keyboards/dichotemy/rules.mk19
-rw-r--r--keyboards/eco/config.h2
-rw-r--r--keyboards/eco/rules.mk15
-rw-r--r--keyboards/ergodox_ez/rules.mk15
-rw-r--r--keyboards/gherkin/keymaps/mjt/config.h2
-rw-r--r--keyboards/gherkin/rules.mk11
-rw-r--r--keyboards/handwired/MS_sculpt_mobile/rules.mk14
-rwxr-xr-xkeyboards/handwired/reddot/rules.mk19
-rw-r--r--keyboards/handwired/space_oddity/config.h2
-rw-r--r--keyboards/handwired/space_oddity/rules.mk11
-rw-r--r--keyboards/handwired/traveller/rules.mk10
-rw-r--r--keyboards/handwired/woodpad/config.h2
-rw-r--r--keyboards/handwired/woodpad/rules.mk15
-rw-r--r--keyboards/iris/rev1/config.h2
-rw-r--r--keyboards/iris/rev2/config.h2
-rw-r--r--keyboards/iris/rules.mk15
-rw-r--r--keyboards/jj40/config.h1
-rwxr-xr-xkeyboards/jj40/program74
-rw-r--r--keyboards/jj40/rules.mk9
-rw-r--r--keyboards/lets_split/rev1/config.h3
-rw-r--r--keyboards/lets_split/rev2/config.h2
-rw-r--r--keyboards/lets_split/rules.mk15
-rw-r--r--keyboards/lets_split/sockets/config.h2
-rw-r--r--keyboards/levinson/rev1/config.h2
-rw-r--r--keyboards/levinson/rev2/config.h3
-rw-r--r--keyboards/levinson/rules.mk15
-rw-r--r--keyboards/mechmini/config.h1
-rw-r--r--keyboards/mechmini/rules.mk7
-rw-r--r--keyboards/minidox/rev1/config.h2
-rw-r--r--keyboards/minidox/rules.mk15
-rw-r--r--keyboards/mitosis/rules.mk18
-rw-r--r--keyboards/mt40/config.h1
-rwxr-xr-xkeyboards/mt40/program74
-rw-r--r--keyboards/mt40/rules.mk9
-rw-r--r--keyboards/nyquist/rev1/config.h2
-rw-r--r--keyboards/nyquist/rules.mk15
-rw-r--r--keyboards/orthodox/rev1/config.h2
-rw-r--r--keyboards/orthodox/rules.mk15
-rw-r--r--keyboards/pearl/config.h1
-rw-r--r--keyboards/pearl/rules.mk7
-rw-r--r--keyboards/planck/light/rules.mk2
-rw-r--r--keyboards/planck/rev3/rules.mk9
-rw-r--r--keyboards/planck/rev4/rules.mk8
-rw-r--r--keyboards/planck/rev5/rules.mk8
-rw-r--r--keyboards/planck/rules.mk21
-rw-r--r--keyboards/preonic/rules.mk20
-rw-r--r--keyboards/ps2avrGB/config.h1
-rw-r--r--keyboards/ps2avrGB/rules.mk7
-rw-r--r--keyboards/viterbi/rev1/config.h2
-rw-r--r--keyboards/viterbi/rules.mk15
-rw-r--r--keyboards/ymd96/config.h1
-rw-r--r--keyboards/ymd96/rules.mk7
-rw-r--r--layouts/community/ergodox/jackhumbert/keymap.c2
-rw-r--r--message.mk8
-rw-r--r--quantum/quantum.c3
-rw-r--r--tmk_core/avr.mk10
-rw-r--r--tmk_core/common/avr/bootloader.c196
-rw-r--r--tmk_core/common/avr/bootloader_size.c20
-rw-r--r--tmk_core/rules.mk23
-rw-r--r--users/drashna/drashna.c2
-rw-r--r--users/drashna/template.c2
76 files changed, 484 insertions, 551 deletions
diff --git a/bootloader.mk b/bootloader.mk
new file mode 100644
index 000000000..55352f3d4
--- /dev/null
+++ b/bootloader.mk
@@ -0,0 +1,62 @@
1# Copyright 2017 Jack Humbert
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# If it's possible that multiple bootloaders can be used for one project,
17# you can leave this unset, and the correct size will be selected
18# automatically.
19#
20# Sets the bootloader defined in the keyboard's/keymap's rules.mk
21# Current options:
22# atmel-dfu
23# lufa-dfu
24# qmk-dfu
25# halfkay
26# caterina
27# bootloadHID
28#
29# BOOTLOADER_SIZE can still be defined manually, but it's recommended
30# you add any possible configuration to this list
31
32ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
33 OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
34 OPT_DEFS += -DBOOTLOADER_DFU
35 BOOTLOADER_SIZE = 4096
36endif
37ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
38 OPT_DEFS += -DBOOTLOADER_LUFA_DFU
39 OPT_DEFS += -DBOOTLOADER_DFU
40 BOOTLOADER_SIZE = 4096
41endif
42ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
43 OPT_DEFS += -DBOOTLOADER_QMK_DFU
44 OPT_DEFS += -DBOOTLOADER_DFU
45 BOOTLOADER_SIZE = 4096
46endif
47ifeq ($(strip $(BOOTLOADER)), halfkay)
48 OPT_DEFS += -DBOOTLOADER_HALFKAY
49 BOOTLOADER_SIZE = 512
50endif
51ifeq ($(strip $(BOOTLOADER)), caterina)
52 OPT_DEFS += -DBOOTLOADER_CATERINA
53 BOOTLOADER_SIZE = 4096
54endif
55ifeq ($(strip $(BOOTLOADER)), bootloadHID)
56 OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
57 BOOTLOADER_SIZE = 4096
58endif
59
60ifdef BOOTLOADER_SIZE
61 OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
62endif \ No newline at end of file
diff --git a/build_keyboard.mk b/build_keyboard.mk
index df025714d..cbdaaa010 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -230,6 +230,7 @@ VPATH += $(USER_PATH)
230include common_features.mk 230include common_features.mk
231include $(TMK_PATH)/protocol.mk 231include $(TMK_PATH)/protocol.mk
232include $(TMK_PATH)/common.mk 232include $(TMK_PATH)/common.mk
233include bootloader.mk
233 234
234SRC += $(TMK_COMMON_SRC) 235SRC += $(TMK_COMMON_SRC)
235OPT_DEFS += $(TMK_COMMON_DEFS) 236OPT_DEFS += $(TMK_COMMON_DEFS)
@@ -266,10 +267,10 @@ $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
266$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG) 267$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
267 268
268# Default target. 269# Default target.
269all: build sizeafter 270all: build check-size
270 271
271# Change the build target to build a HEX file or a library. 272# Change the build target to build a HEX file or a library.
272build: elf hex 273build: elf cphex
273#build: elf hex eep lss sym 274#build: elf hex eep lss sym
274#build: lib 275#build: lib
275 276
diff --git a/docs/flashing.md b/docs/flashing.md
index a61634d21..5b3c1a444 100644
--- a/docs/flashing.md
+++ b/docs/flashing.md
@@ -1,12 +1,20 @@
1# Flashing Intrustructions 1# Flashing Intrustructions / Bootloader Information
2 2
3There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them. 3There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them.
4 4
5If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size it bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
6
5## DFU 7## DFU
6 8
7Atmel's DFU bootloader comes on all atmega32u4 chips by default, and is used by many keyboards that have their own ICs on their PCBs (Older OLKB boards, Clueboards). Some keyboards may also use LUFA's DFU bootloader (or QMK's fork) (Newer OLKB boards) that adds in additional features specific to that hardware. 9Atmel's DFU bootloader comes on all atmega32u4 chips by default, and is used by many keyboards that have their own ICs on their PCBs (Older OLKB boards, Clueboards). Some keyboards may also use LUFA's DFU bootloader (or QMK's fork) (Newer OLKB boards) that adds in additional features specific to that hardware.
8 10
9These bootloaders are usually 4096 bytes for the atmega32u4 chip. 11To ensure compatability with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
12
13 # Bootloader
14 # This definition is optional, and if your keyboard supports multiple bootloaders of
15 # different sizes, comment this out, and the correct address will be loaded
16 # automatically (+60). See bootloader.mk for all options.
17 BOOTLOADER = atmel-dfu
10 18
11Compatible flashers: 19Compatible flashers:
12 20
@@ -26,15 +34,32 @@ or:
26 34
27 make <keyboard>:<keymap>:dfu 35 make <keyboard>:<keymap>:dfu
28 36
37### QMK DFU
38
39QMK has a fork of the LUFA DFU bootloader that allows for a simple matrix scan for exiting the bootloader and returning to the application, as well as flashing an LED/making a ticking noise with a speaker when things are happening. To enable these features, use this block in your `config.h` (The key that exits the bootloader needs to be hooked-up to the INPUT and OUTPUT defined here):
40
41 #define QMK_ESC_OUTPUT F1 // usually COL
42 #define QMK_ESC_INPUT D5 // usually ROW
43 #define QMK_LED E6
44 #define QMK_SPEAKER C6
45
46The Manufacturer and Product names are automatically pulled from your `config.h`, and "Bootloader" is added to the product.
47
48To generate this bootloader, use the `bootloader` target, eg `make planck/rev4:default:bootloader`.
49
50To generate a production-ready .hex file (containing the application and the bootloader), use the `production` target, eg `make planck/rev4:default:production`.
51
29## Caterina 52## Caterina
30 53
31Arduino boards and their clones use the [Caterina bootloader](https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/bootloaders/caterina) (any keyboard built with a Pro Micro, or clone), and uses the avr109 protocol to communicate through virtual serial. Bootloaders like [A-Star](https://www.pololu.com/docs/0J61/9) are based on Caterina. 54Arduino boards and their clones use the [Caterina bootloader](https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/bootloaders/caterina) (any keyboard built with a Pro Micro, or clone), and uses the avr109 protocol to communicate through virtual serial. Bootloaders like [A-Star](https://www.pololu.com/docs/0J61/9) are based on Caterina.
32 55
33This block of code allows for Caterina compatibility in QMK: 56To ensure compatability with the Caterina bootloader, make sure this block is present your `rules.mk`:
34 57
35 #define CATERINA_BOOTLOADER 58 # Bootloader
36 59 # This definition is optional, and if your keyboard supports multiple bootloaders of
37These bootloaders are usually 4096 bytes for the atmega32u4 chip. 60 # different sizes, comment this out, and the correct address will be loaded
61 # automatically (+60). See bootloader.mk for all options.
62 BOOTLOADER = caterina
38 63
39Compatible flashers: 64Compatible flashers:
40 65
@@ -57,7 +82,13 @@ or
57 82
58Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0). 83Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).
59 84
60This bootloader is 512 bytes. 85To ensure compatability with the Halfkay bootloader, make sure this block is present your `rules.mk`:
86
87 # Bootloader
88 # This definition is optional, and if your keyboard supports multiple bootloaders of
89 # different sizes, comment this out, and the correct address will be loaded
90 # automatically (+60). See bootloader.mk for all options.
91 BOOTLOADER = halfkay
61 92
62Compatible flashers: 93Compatible flashers:
63 94
diff --git a/keyboards/atreus/rules.mk b/keyboards/atreus/rules.mk
index 0a254d0e7..2c8418beb 100644
--- a/keyboards/atreus/rules.mk
+++ b/keyboards/atreus/rules.mk
@@ -5,7 +5,6 @@ ifdef TEENSY2
5 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex 5 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
6else 6else
7 OPT_DEFS += -DATREUS_ASTAR 7 OPT_DEFS += -DATREUS_ASTAR
8 OPT_DEFS += -DCATERINA_BOOTLOADER
9 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 8 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
10 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 9 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
11endif 10endif
@@ -27,7 +26,6 @@ MCU = atmega32u4
27# software delays. 26# software delays.
28F_CPU = 16000000 27F_CPU = 16000000
29 28
30
31# 29#
32# LUFA specific 30# LUFA specific
33# 31#
@@ -47,19 +45,20 @@ ARCH = AVR8
47# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 45# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
48F_USB = $(F_CPU) 46F_USB = $(F_CPU)
49 47
48# Bootloader
49# This definition is optional, and if your keyboard supports multiple bootloaders of
50# different sizes, comment this out, and the correct address will be loaded
51# automatically (+60). See bootloader.mk for all options.
52ifdef TEENSY2
53 BOOTLOADER = halfkay
54else
55 BOOTLOADER = caterina
56endif
57
50# Interrupt driven control endpoint task(+60) 58# Interrupt driven control endpoint task(+60)
51OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 59OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
52 60
53 61
54# Boot Section Size in *bytes*
55# Teensy halfKay 512
56# Teensy++ halfKay 1024
57# Atmel DFU loader 4096
58# LUFA bootloader 4096
59# USBaspLoader 2048
60OPT_DEFS += -DBOOTLOADER_SIZE=4096
61
62
63# Build Options 62# Build Options
64# comment out to disable the options. 63# comment out to disable the options.
65# 64#
diff --git a/keyboards/atreus62/config.h b/keyboards/atreus62/config.h
index 90a4aa05a..8d9248947 100644
--- a/keyboards/atreus62/config.h
+++ b/keyboards/atreus62/config.h
@@ -38,8 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
38#define MATRIX_ROW_PINS { D2, D3, D1, D0, D4 } 38#define MATRIX_ROW_PINS { D2, D3, D1, D0, D4 }
39#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, C6 } 39#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, C6 }
40 40
41#define CATERINA_BOOTLOADER
42
43/* COL2ROW or ROW2COL */ 41/* COL2ROW or ROW2COL */
44#define DIODE_DIRECTION ROW2COL 42#define DIODE_DIRECTION ROW2COL
45 43
diff --git a/keyboards/atreus62/rules.mk b/keyboards/atreus62/rules.mk
index ca399e9c5..66f6660c6 100644
--- a/keyboards/atreus62/rules.mk
+++ b/keyboards/atreus62/rules.mk
@@ -35,18 +35,15 @@ ARCH = AVR8
35# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 35# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
36F_USB = $(F_CPU) 36F_USB = $(F_CPU)
37 37
38# Bootloader
39# This definition is optional, and if your keyboard supports multiple bootloaders of
40# different sizes, comment this out, and the correct address will be loaded
41# automatically (+60). See bootloader.mk for all options.
42BOOTLOADER = caterina
43
38# Interrupt driven control endpoint task(+60) 44# Interrupt driven control endpoint task(+60)
39OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 45OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
40 46
41
42# Boot Section Size in *bytes*
43# Teensy halfKay 512
44# Teensy++ halfKay 1024
45# Atmel DFU loader 4096
46# LUFA bootloader 4096
47# USBaspLoader 2048
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50# Build Options 47# Build Options
51# change to "no" to disable the options, or define them in the Makefile in 48# change to "no" to disable the options, or define them in the Makefile in
52# the appropriate keymap folder that will get included automatically 49# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/bfake/config.h b/keyboards/bfake/config.h
index c52d9175b..c0e0face5 100644
--- a/keyboards/bfake/config.h
+++ b/keyboards/bfake/config.h
@@ -41,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
41#define RGBLIGHT_ANIMATIONS 41#define RGBLIGHT_ANIMATIONS
42 42
43#define NO_UART 1 43#define NO_UART 1
44#define BOOTLOADHID_BOOTLOADER 1
45 44
46/* key combination for command */ 45/* key combination for command */
47#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 46#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/bfake/rules.mk b/keyboards/bfake/rules.mk
index d08985827..9165de424 100644
--- a/keyboards/bfake/rules.mk
+++ b/keyboards/bfake/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = bootloadHID
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/keyboards/bmini/config.h b/keyboards/bmini/config.h
index 90b315b7c..b7a25e050 100644
--- a/keyboards/bmini/config.h
+++ b/keyboards/bmini/config.h
@@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34#define RGBLIGHT_ANIMATIONS 34#define RGBLIGHT_ANIMATIONS
35 35
36#define NO_UART 1 36#define NO_UART 1
37#define BOOTLOADHID_BOOTLOADER 1
38 37
39/* key combination for command */ 38/* key combination for command */
40#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 39#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/bmini/rules.mk b/keyboards/bmini/rules.mk
index 41a87973d..73c361e2a 100644
--- a/keyboards/bmini/rules.mk
+++ b/keyboards/bmini/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = bootloadHID
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/keyboards/chimera_ortho/rules.mk b/keyboards/chimera_ortho/rules.mk
index 098bf28fa..4f95949f9 100644
--- a/keyboards/chimera_ortho/rules.mk
+++ b/keyboards/chimera_ortho/rules.mk
@@ -1,6 +1,5 @@
1 1
2OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO 2OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO
3OPT_DEFS += -DCATERINA_BOOTLOADER
4CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 3CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
5 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 4 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
6 5
@@ -45,19 +44,15 @@ ARCH = AVR8
45# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 44# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
46F_USB = $(F_CPU) 45F_USB = $(F_CPU)
47 46
47# Bootloader
48# This definition is optional, and if your keyboard supports multiple bootloaders of
49# different sizes, comment this out, and the correct address will be loaded
50# automatically (+60). See bootloader.mk for all options.
51BOOTLOADER = caterina
52
48# Interrupt driven control endpoint task(+60) 53# Interrupt driven control endpoint task(+60)
49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 54OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
50 55
51
52# Boot Section Size in *bytes*
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58OPT_DEFS += -DBOOTLOADER_SIZE=4096
59
60
61# Build Options 56# Build Options
62# comment out to disable the options. 57# comment out to disable the options.
63# 58#
diff --git a/keyboards/converter/usb_usb/ble/rules.mk b/keyboards/converter/usb_usb/ble/rules.mk
index c951780e2..16090962d 100644
--- a/keyboards/converter/usb_usb/ble/rules.mk
+++ b/keyboards/converter/usb_usb/ble/rules.mk
@@ -1,4 +1,3 @@
1BLUETOOTH = AdafruitBLE 1BLUETOOTH = AdafruitBLE
2ADAFRUIT_BLE_ENABLE = yes 2ADAFRUIT_BLE_ENABLE = yes
3OPT_DEFS += -DCATERINA_BOOTLOADER
4F_CPU = 8000000 3F_CPU = 8000000
diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk
index b0e07c764..7a8f24bb4 100644
--- a/keyboards/converter/usb_usb/rules.mk
+++ b/keyboards/converter/usb_usb/rules.mk
@@ -43,19 +43,15 @@ ARCH = AVR8
43# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 43# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
44F_USB = $(F_CPU) 44F_USB = $(F_CPU)
45 45
46# Bootloader
47# This definition is optional, and if your keyboard supports multiple bootloaders of
48# different sizes, comment this out, and the correct address will be loaded
49# automatically (+60). See bootloader.mk for all options.
50BOOTLOADER = caterina
51
46# Interrupt driven control endpoint task 52# Interrupt driven control endpoint task
47OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 53OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
48 54
49
50# Boot Section Size in *bytes*
51# Teensy halfKay 512
52# Teensy++ halfKay 1024
53# Atmel DFU loader 4096
54# LUFA bootloader 4096
55# USBaspLoader 2048
56OPT_DEFS += -DBOOTLOADER_SIZE=4096
57
58
59# Build Options 55# Build Options
60# comment out to disable the options. 56# comment out to disable the options.
61# 57#
diff --git a/keyboards/deltasplit75/rules.mk b/keyboards/deltasplit75/rules.mk
index e345d61f5..2a13dbdfc 100644
--- a/keyboards/deltasplit75/rules.mk
+++ b/keyboards/deltasplit75/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/deltasplit75/v2/config.h b/keyboards/deltasplit75/v2/config.h
index b677d09aa..319a149fb 100644
--- a/keyboards/deltasplit75/v2/config.h
+++ b/keyboards/deltasplit75/v2/config.h
@@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 } 37#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
38#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1} 38#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
39 39
40#define CATERINA_BOOTLOADER
41
42/* COL2ROW or ROW2COL */ 40/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW 41#define DIODE_DIRECTION COL2ROW
44 42
diff --git a/keyboards/dichotemy/rules.mk b/keyboards/dichotemy/rules.mk
index c8a316f84..4e9db8687 100644
--- a/keyboards/dichotemy/rules.mk
+++ b/keyboards/dichotemy/rules.mk
@@ -1,6 +1,5 @@
1 1
2OPT_DEFS += -DDICHOTEMY_PROMICRO 2OPT_DEFS += -DDICHOTEMY_PROMICRO
3OPT_DEFS += -DCATERINA_BOOTLOADER
4DICHOTEMY_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 3DICHOTEMY_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
5 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 4 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
6 5
@@ -25,8 +24,6 @@ MCU = atmega32u4
25# software delays. 24# software delays.
26F_CPU = 16000000 25F_CPU = 16000000
27 26
28
29#
30# LUFA specific 27# LUFA specific
31# 28#
32# Target architecture (see library "Board Types" documentation). 29# Target architecture (see library "Board Types" documentation).
@@ -45,19 +42,15 @@ ARCH = AVR8
45# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 42# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
46F_USB = $(F_CPU) 43F_USB = $(F_CPU)
47 44
45# Bootloader
46# This definition is optional, and if your keyboard supports multiple bootloaders of
47# different sizes, comment this out, and the correct address will be loaded
48# automatically (+60). See bootloader.mk for all options.
49BOOTLOADER = caterina
50
48# Interrupt driven control endpoint task(+60) 51# Interrupt driven control endpoint task(+60)
49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 52OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
50 53
51
52# Boot Section Size in *bytes*
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58OPT_DEFS += -DBOOTLOADER_SIZE=4096
59
60
61# Build Options 54# Build Options
62# comment out to disable the options. 55# comment out to disable the options.
63# 56#
diff --git a/keyboards/eco/config.h b/keyboards/eco/config.h
index 99b057496..f6b78631e 100644
--- a/keyboards/eco/config.h
+++ b/keyboards/eco/config.h
@@ -31,8 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#define MATRIX_ROWS 4 31#define MATRIX_ROWS 4
32#define MATRIX_COLS 14 32#define MATRIX_COLS 14
33 33
34#define CATERINA_BOOTLOADER
35
36/* COL2ROW or ROW2COL */ 34/* COL2ROW or ROW2COL */
37#define DIODE_DIRECTION COL2ROW 35#define DIODE_DIRECTION COL2ROW
38 36
diff --git a/keyboards/eco/rules.mk b/keyboards/eco/rules.mk
index 6f4b4fefc..35ee906b1 100644
--- a/keyboards/eco/rules.mk
+++ b/keyboards/eco/rules.mk
@@ -34,18 +34,15 @@ ARCH = AVR8
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU) 35F_USB = $(F_CPU)
36 36
37# Bootloader
38# This definition is optional, and if your keyboard supports multiple bootloaders of
39# different sizes, comment this out, and the correct address will be loaded
40# automatically (+60). See bootloader.mk for all options.
41BOOTLOADER = caterina
42
37# Interrupt driven control endpoint task(+60) 43# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 44OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39 45
40
41# Boot Section Size in *bytes*
42# Teensy halfKay 512
43# Teensy++ halfKay 1024
44# Atmel DFU loader 4096
45# LUFA bootloader 4096
46# USBaspLoader 2048
47OPT_DEFS += -DBOOTLOADER_SIZE=4096
48
49# Build Options 46# Build Options
50# change to "no" to disable the options, or define them in the Makefile in 47# change to "no" to disable the options, or define them in the Makefile in
51# the appropriate keymap folder that will get included automatically 48# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk
index 3d6b18fea..4d2c46108 100644
--- a/keyboards/ergodox_ez/rules.mk
+++ b/keyboards/ergodox_ez/rules.mk
@@ -54,18 +54,15 @@ ARCH = AVR8
54# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 54# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
55F_USB = $(F_CPU) 55F_USB = $(F_CPU)
56 56
57# Bootloader
58# This definition is optional, and if your keyboard supports multiple bootloaders of
59# different sizes, comment this out, and the correct address will be loaded
60# automatically (+60). See bootloader.mk for all options.
61BOOTLOADER = halfkay
62
57# Interrupt driven control endpoint task(+60) 63# Interrupt driven control endpoint task(+60)
58OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 64OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
59 65
60
61# Boot Section Size in *bytes*
62# Teensy halfKay 512
63# Teensy++ halfKay 1024
64# Atmel DFU loader 4096
65# LUFA bootloader 4096
66# USBaspLoader 2048
67OPT_DEFS += -DBOOTLOADER_SIZE=512
68
69# If you have Left LEDs (see 66# If you have Left LEDs (see
70# https://geekhack.org/index.php?topic=22780.msg873819#msg873819 for 67# https://geekhack.org/index.php?topic=22780.msg873819#msg873819 for
71# details), include the following define: 68# details), include the following define:
diff --git a/keyboards/gherkin/keymaps/mjt/config.h b/keyboards/gherkin/keymaps/mjt/config.h
index 9c9f03838..bb59ec213 100644
--- a/keyboards/gherkin/keymaps/mjt/config.h
+++ b/keyboards/gherkin/keymaps/mjt/config.h
@@ -52,8 +52,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
52#define MATRIX_ROW_PINS { F7, B1, B3, B2, B6 } 52#define MATRIX_ROW_PINS { F7, B1, B3, B2, B6 }
53#define MATRIX_COL_PINS { B4, E6, D7, F6, D4, D0 } 53#define MATRIX_COL_PINS { B4, E6, D7, F6, D4, D0 }
54 54
55#define CATERINA_BOOTLOADER
56
57#define UNUSED_PINS 55#define UNUSED_PINS
58 56
59/* COL2ROW or ROW2COL */ 57/* COL2ROW or ROW2COL */
diff --git a/keyboards/gherkin/rules.mk b/keyboards/gherkin/rules.mk
index 6bb9edb35..530898bd7 100644
--- a/keyboards/gherkin/rules.mk
+++ b/keyboards/gherkin/rules.mk
@@ -33,14 +33,15 @@ ARCH = AVR8
33# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 33# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
34F_USB = $(F_CPU) 34F_USB = $(F_CPU)
35 35
36# Bootloader
37# This definition is optional, and if your keyboard supports multiple bootloaders of
38# different sizes, comment this out, and the correct address will be loaded
39# automatically (+60). See bootloader.mk for all options.
40BOOTLOADER = caterina
41
36# Interrupt driven control endpoint task(+60) 42# Interrupt driven control endpoint task(+60)
37OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
38 44
39
40# Boot Section Size in *bytes*
41OPT_DEFS += -DBOOTLOADER_SIZE=4096
42
43
44# Build Options 45# Build Options
45# comment out to disable the options. 46# comment out to disable the options.
46# 47#
diff --git a/keyboards/handwired/MS_sculpt_mobile/rules.mk b/keyboards/handwired/MS_sculpt_mobile/rules.mk
index 53769f81f..680c057d3 100644
--- a/keyboards/handwired/MS_sculpt_mobile/rules.mk
+++ b/keyboards/handwired/MS_sculpt_mobile/rules.mk
@@ -5,21 +5,29 @@ SRC= babblePaste.c
5 5
6ifdef ASTAR 6ifdef ASTAR
7 CFLAGS=-D ASTAR 7 CFLAGS=-D ASTAR
8 OPT_DEFS += -DBOOTLOADER_SIZE=4096
9 MCU = atmega32u4 8 MCU = atmega32u4
10 OPT_DEFS += -DCATERINA_BOOTLOADER
11 SCULPT_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done ; \ 9 SCULPT_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done ; \
12 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 10 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
13 11
14else 12else
15 MCU = at90usb1286 13 MCU = at90usb1286
16 OPT_DEFS += -DBOOTLOADER_SIZE=2048
17 SCULPT_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex 14 SCULPT_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
18endif 15endif
19 16
20F_CPU = 16000000 17F_CPU = 16000000
21ARCH = AVR8 18ARCH = AVR8
22F_USB = $(F_CPU) 19F_USB = $(F_CPU)
20
21# Bootloader
22# This definition is optional, and if your keyboard supports multiple bootloaders of
23# different sizes, comment this out, and the correct address will be loaded
24# automatically (+60). See bootloader.mk for all options.
25ifdef ASTAR
26 BOOTLOADER = caterina
27else
28 BOOTLOADER = atmel-dfu
29endif
30
23# Interrupt driven control endpoint task(+60) 31# Interrupt driven control endpoint task(+60)
24OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 32OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
25 33
diff --git a/keyboards/handwired/reddot/rules.mk b/keyboards/handwired/reddot/rules.mk
index 492996841..00ca06dd4 100755
--- a/keyboards/handwired/reddot/rules.mk
+++ b/keyboards/handwired/reddot/rules.mk
@@ -36,30 +36,25 @@ ARCH = AVR8
36# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 36# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
37F_USB = $(F_CPU) 37F_USB = $(F_CPU)
38 38
39 39# Bootloader
40# This definition is optional, and if your keyboard supports multiple bootloaders of
41# different sizes, comment this out, and the correct address will be loaded
42# automatically (+60). See bootloader.mk for all options.
40ifdef TEENSY2 43ifdef TEENSY2
44 BOOTLOADER = halfkay
41 OPT_DEFS += -DATREUS_TEENSY2 45 OPT_DEFS += -DATREUS_TEENSY2
42 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex 46 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
43else 47else
48 BOOTLOADER = caterina
44 OPT_DEFS += -DATREUS_ASTAR 49 OPT_DEFS += -DATREUS_ASTAR
45 OPT_DEFS += -DCATERINA_BOOTLOADER
46 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 50 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
47 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 51 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
48endif 52endif
53
49# Interrupt driven control endpoint task(+60) 54# Interrupt driven control endpoint task(+60)
50OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 55OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
51 56
52 57
53# MCU name
54
55# Boot Section Size in *bytes*
56# Teensy halfKay 512
57# Teensy++ halfKay 1024
58# Atmel DFU loader 4096
59# LUFA bootloader 4096
60# USBaspLoader 2048
61OPT_DEFS += -DBOOTLOADER_SIZE=4096
62
63 58
64# Build Options 59# Build Options
65# change yes to no to disable 60# change yes to no to disable
diff --git a/keyboards/handwired/space_oddity/config.h b/keyboards/handwired/space_oddity/config.h
index 88cc5ad00..9c9361ced 100644
--- a/keyboards/handwired/space_oddity/config.h
+++ b/keyboards/handwired/space_oddity/config.h
@@ -11,8 +11,6 @@
11#define PRODUCT Space Odyssey 11#define PRODUCT Space Odyssey
12#define DESCRIPTION Keyboard 12#define DESCRIPTION Keyboard
13 13
14#define CATERINA_BOOTLOADER
15
16#define MOUSEKEY_INTERVAL 16 14#define MOUSEKEY_INTERVAL 16
17#define MOUSEKEY_DELAY 0 15#define MOUSEKEY_DELAY 0
18#define MOUSEKEY_TIME_TO_MAX 60 16#define MOUSEKEY_TIME_TO_MAX 60
diff --git a/keyboards/handwired/space_oddity/rules.mk b/keyboards/handwired/space_oddity/rules.mk
index 170c64a30..4dc93fad9 100644
--- a/keyboards/handwired/space_oddity/rules.mk
+++ b/keyboards/handwired/space_oddity/rules.mk
@@ -33,14 +33,15 @@ ARCH = AVR8
33# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 33# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
34F_USB = $(F_CPU) 34F_USB = $(F_CPU)
35 35
36# Bootloader
37# This definition is optional, and if your keyboard supports multiple bootloaders of
38# different sizes, comment this out, and the correct address will be loaded
39# automatically (+60). See bootloader.mk for all options.
40BOOTLOADER = caterina
41
36# Interrupt driven control endpoint task(+60) 42# Interrupt driven control endpoint task(+60)
37OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
38 44
39
40# Boot Section Size in *bytes*
41OPT_DEFS += -DBOOTLOADER_SIZE=4096
42
43
44# Build Options 45# Build Options
45# comment out to disable the options. 46# comment out to disable the options.
46# 47#
diff --git a/keyboards/handwired/traveller/rules.mk b/keyboards/handwired/traveller/rules.mk
index 62f94b945..8568def35 100644
--- a/keyboards/handwired/traveller/rules.mk
+++ b/keyboards/handwired/traveller/rules.mk
@@ -37,15 +37,23 @@ ARCH = AVR8
37F_USB = $(F_CPU) 37F_USB = $(F_CPU)
38 38
39 39
40# Bootloader
41# This definition is optional, and if your keyboard supports multiple bootloaders of
42# different sizes, comment this out, and the correct address will be loaded
43# automatically (+60). See bootloader.mk for all options.
40ifdef TEENSY2 44ifdef TEENSY2
45 BOOTLOADER = halfkay
41 OPT_DEFS += -DATREUS_TEENSY2 46 OPT_DEFS += -DATREUS_TEENSY2
42 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex 47 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
43else 48else
49 BOOTLOADER = caterina
44 OPT_DEFS += -DATREUS_ASTAR 50 OPT_DEFS += -DATREUS_ASTAR
45 OPT_DEFS += -DCATERINA_BOOTLOADER
46 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 51 ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
47 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 52 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
48endif 53endif
54
55
56
49# Interrupt driven control endpoint task(+60) 57# Interrupt driven control endpoint task(+60)
50OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 58OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
51 59
diff --git a/keyboards/handwired/woodpad/config.h b/keyboards/handwired/woodpad/config.h
index 39a466850..b2eb7020f 100644
--- a/keyboards/handwired/woodpad/config.h
+++ b/keyboards/handwired/woodpad/config.h
@@ -53,8 +53,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
53// #define BACKLIGHT_BREATHING 53// #define BACKLIGHT_BREATHING
54// #define BACKLIGHT_LEVELS 3 54// #define BACKLIGHT_LEVELS 3
55 55
56#define CATERINA_BOOTLOADER
57
58/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 56/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
59#define DEBOUNCING_DELAY 5 57#define DEBOUNCING_DELAY 5
60 58
diff --git a/keyboards/handwired/woodpad/rules.mk b/keyboards/handwired/woodpad/rules.mk
index 7612f4b49..11f096581 100644
--- a/keyboards/handwired/woodpad/rules.mk
+++ b/keyboards/handwired/woodpad/rules.mk
@@ -35,19 +35,16 @@ ARCH = AVR8
35# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 35# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
36F_USB = $(F_CPU) 36F_USB = $(F_CPU)
37 37
38# Bootloader
39# This definition is optional, and if your keyboard supports multiple bootloaders of
40# different sizes, comment this out, and the correct address will be loaded
41# automatically (+60). See bootloader.mk for all options.
42BOOTLOADER = caterina
43
38# Interrupt driven control endpoint task(+60) 44# Interrupt driven control endpoint task(+60)
39OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 45OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
40 46
41 47
42# Boot Section Size in *bytes*
43# Teensy halfKay 512
44# Teensy++ halfKay 1024
45# Atmel DFU loader 4096
46# LUFA bootloader 4096
47# USBaspLoader 2048
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50
51# Build Options 48# Build Options
52# change yes to no to disable 49# change yes to no to disable
53# 50#
diff --git a/keyboards/iris/rev1/config.h b/keyboards/iris/rev1/config.h
index 10f435a4f..c9bc62528 100644
--- a/keyboards/iris/rev1/config.h
+++ b/keyboards/iris/rev1/config.h
@@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } 37#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 }
38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } 38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }
39 39
40#define CATERINA_BOOTLOADER
41
42/* COL2ROW or ROW2COL */ 40/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW 41#define DIODE_DIRECTION COL2ROW
44 42
diff --git a/keyboards/iris/rev2/config.h b/keyboards/iris/rev2/config.h
index 4ba21a58a..290fba450 100644
--- a/keyboards/iris/rev2/config.h
+++ b/keyboards/iris/rev2/config.h
@@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define MATRIX_ROW_PINS { D7, E6, B4, D2, D4 } 37#define MATRIX_ROW_PINS { D7, E6, B4, D2, D4 }
38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } 38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
39 39
40#define CATERINA_BOOTLOADER
41
42/* COL2ROW or ROW2COL */ 40/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW 41#define DIODE_DIRECTION COL2ROW
44 42
diff --git a/keyboards/iris/rules.mk b/keyboards/iris/rules.mk
index 0280e9d1a..db4bf3a1e 100644
--- a/keyboards/iris/rules.mk
+++ b/keyboards/iris/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/jj40/config.h b/keyboards/jj40/config.h
index 42a37c957..02339a33f 100644
--- a/keyboards/jj40/config.h
+++ b/keyboards/jj40/config.h
@@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
38#define TAPPING_TOGGLE 3 38#define TAPPING_TOGGLE 3
39 39
40#define NO_UART 1 40#define NO_UART 1
41#define BOOTLOADHID_BOOTLOADER 1
42 41
43/* key combination for command */ 42/* key combination for command */
44#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 43#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/jj40/program b/keyboards/jj40/program
deleted file mode 100755
index 81552c272..000000000
--- a/keyboards/jj40/program
+++ /dev/null
@@ -1,74 +0,0 @@
1#!/usr/bin/env python
2# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from __future__ import print_function
18
19import os
20import sys
21import time
22import usb
23
24if len(sys.argv) < 2:
25 print('Usage: %s <firmware.hex>' % sys.argv[0])
26 sys.exit(1)
27
28print('Searching for jj40... ', end='')
29
30dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
31if dev is None:
32 raise ValueError('Device not found')
33
34print('Found', end='\n\n')
35
36print('Device Information:')
37print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
38print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
39print('Manufacturer: %s' % (dev.iManufacturer))
40print('Serial: %s' % (dev.iSerialNumber))
41print('Product: %s' % (dev.iProduct), end='\n\n')
42
43print('Transferring control to bootloader... ', end='')
44
45dev.set_configuration()
46
47request_type = usb.util.build_request_type(
48 usb.util.CTRL_OUT,
49 usb.util.CTRL_TYPE_CLASS,
50 usb.util.CTRL_RECIPIENT_DEVICE)
51
52USBRQ_HID_SET_REPORT = 0x09
53HID_REPORT_OPTION = 0x0301
54
55
56try:
57 dev.ctrl_transfer(
58 request_type,
59 USBRQ_HID_SET_REPORT,
60 HID_REPORT_OPTION,
61 0,
62 [0, 0, 0xFF] + [0] * 5
63 )
64except usb.core.USBError:
65 # for some reason I keep getting USBError, but it works!
66 pass
67
68# wait a bit until bootloader starts up
69time.sleep(2)
70
71print('OK')
72print('Programming...')
73if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
74 print('\nDone!')
diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk
index c39ebf222..c6279a2a5 100644
--- a/keyboards/jj40/rules.mk
+++ b/keyboards/jj40/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = bootloadHID
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = no 34BOOTMAGIC_ENABLE = no
29MOUSEKEY_ENABLE = no 35MOUSEKEY_ENABLE = no
@@ -39,11 +45,10 @@ KEY_LOCK_ENABLE = yes
39SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 45SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
40 46
41OPT_DEFS = -DDEBUG_LEVEL=0 47OPT_DEFS = -DDEBUG_LEVEL=0
42OPT_DEFS += -DBOOTLOADER_SIZE=2048
43 48
44# custom matrix setup 49# custom matrix setup
45CUSTOM_MATRIX = yes 50CUSTOM_MATRIX = yes
46SRC = matrix.c i2c.c 51SRC = matrix.c i2c.c
47 52
48# programming options 53# programming options
49PROGRAM_CMD = ./keyboards/jj40/program $(TARGET).hex 54PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
diff --git a/keyboards/lets_split/rev1/config.h b/keyboards/lets_split/rev1/config.h
index 7c128421d..73f90e715 100644
--- a/keyboards/lets_split/rev1/config.h
+++ b/keyboards/lets_split/rev1/config.h
@@ -39,9 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 } 39#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
40// #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 40// #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
41 41
42
43#define CATERINA_BOOTLOADER
44
45/* define if matrix has ghost */ 42/* define if matrix has ghost */
46//#define MATRIX_HAS_GHOST 43//#define MATRIX_HAS_GHOST
47 44
diff --git a/keyboards/lets_split/rev2/config.h b/keyboards/lets_split/rev2/config.h
index 1f0603d50..1c48f38e0 100644
--- a/keyboards/lets_split/rev2/config.h
+++ b/keyboards/lets_split/rev2/config.h
@@ -39,8 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } 39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
40// #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 40// #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
41 41
42#define CATERINA_BOOTLOADER
43
44/* define if matrix has ghost */ 42/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST 43//#define MATRIX_HAS_GHOST
46 44
diff --git a/keyboards/lets_split/rules.mk b/keyboards/lets_split/rules.mk
index 1bbc0367f..f9dc127bc 100644
--- a/keyboards/lets_split/rules.mk
+++ b/keyboards/lets_split/rules.mk
@@ -40,18 +40,15 @@ ARCH = AVR8
40# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 40# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
41F_USB = $(F_CPU) 41F_USB = $(F_CPU)
42 42
43# Bootloader
44# This definition is optional, and if your keyboard supports multiple bootloaders of
45# different sizes, comment this out, and the correct address will be loaded
46# automatically (+60). See bootloader.mk for all options.
47BOOTLOADER = caterina
48
43# Interrupt driven control endpoint task(+60) 49# Interrupt driven control endpoint task(+60)
44OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 50OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
45 51
46
47# Boot Section Size in *bytes*
48# Teensy halfKay 512
49# Teensy++ halfKay 1024
50# Atmel DFU loader 4096
51# LUFA bootloader 4096
52# USBaspLoader 2048
53OPT_DEFS += -DBOOTLOADER_SIZE=4096
54
55# Build Options 52# Build Options
56# change to "no" to disable the options, or define them in the Makefile in 53# change to "no" to disable the options, or define them in the Makefile in
57# the appropriate keymap folder that will get included automatically 54# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/lets_split/sockets/config.h b/keyboards/lets_split/sockets/config.h
index 0543e8930..70ebcb8c2 100644
--- a/keyboards/lets_split/sockets/config.h
+++ b/keyboards/lets_split/sockets/config.h
@@ -39,8 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39#define MATRIX_COL_PINS { F4, F7, D7, B3, B2, B6} 39#define MATRIX_COL_PINS { F4, F7, D7, B3, B2, B6}
40// #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 40// #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
41 41
42#define CATERINA_BOOTLOADER
43
44/* define if matrix has ghost */ 42/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST 43//#define MATRIX_HAS_GHOST
46 44
diff --git a/keyboards/levinson/rev1/config.h b/keyboards/levinson/rev1/config.h
index 7c8b9b0b9..ddccbc47a 100644
--- a/keyboards/levinson/rev1/config.h
+++ b/keyboards/levinson/rev1/config.h
@@ -38,8 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
38#define MATRIX_ROW_PINS { D7, E6, B4, B5 } 38#define MATRIX_ROW_PINS { D7, E6, B4, B5 }
39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } 39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }
40 40
41#define CATERINA_BOOTLOADER
42
43/* define if matrix has ghost */ 41/* define if matrix has ghost */
44//#define MATRIX_HAS_GHOST 42//#define MATRIX_HAS_GHOST
45 43
diff --git a/keyboards/levinson/rev2/config.h b/keyboards/levinson/rev2/config.h
index 27d451a3b..51ae5cd3c 100644
--- a/keyboards/levinson/rev2/config.h
+++ b/keyboards/levinson/rev2/config.h
@@ -38,9 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
38#define MATRIX_ROW_PINS { D4, D7, E6, B4 } 38#define MATRIX_ROW_PINS { D4, D7, E6, B4 }
39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } 39#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
40 40
41
42#define CATERINA_BOOTLOADER
43
44/* define if matrix has ghost */ 41/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST 42//#define MATRIX_HAS_GHOST
46 43
diff --git a/keyboards/levinson/rules.mk b/keyboards/levinson/rules.mk
index 0ca19e9a0..8e67497f4 100644
--- a/keyboards/levinson/rules.mk
+++ b/keyboards/levinson/rules.mk
@@ -40,18 +40,15 @@ ARCH = AVR8
40# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 40# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
41F_USB = $(F_CPU) 41F_USB = $(F_CPU)
42 42
43# Bootloader
44# This definition is optional, and if your keyboard supports multiple bootloaders of
45# different sizes, comment this out, and the correct address will be loaded
46# automatically (+60). See bootloader.mk for all options.
47BOOTLOADER = caterina
48
43# Interrupt driven control endpoint task(+60) 49# Interrupt driven control endpoint task(+60)
44OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 50OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
45 51
46
47# Boot Section Size in *bytes*
48# Teensy halfKay 512
49# Teensy++ halfKay 1024
50# Atmel DFU loader 4096
51# LUFA bootloader 4096
52# USBaspLoader 2048
53OPT_DEFS += -DBOOTLOADER_SIZE=4096
54
55# Build Options 52# Build Options
56# change to "no" to disable the options, or define them in the Makefile in 53# change to "no" to disable the options, or define them in the Makefile in
57# the appropriate keymap folder that will get included automatically 54# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/mechmini/config.h b/keyboards/mechmini/config.h
index 96f4bb51e..e7004608e 100644
--- a/keyboards/mechmini/config.h
+++ b/keyboards/mechmini/config.h
@@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35#define RGB_DI_PIN E2 35#define RGB_DI_PIN E2
36 36
37#define NO_UART 1 37#define NO_UART 1
38#define BOOTLOADHID_BOOTLOADER 1
39 38
40/* key combination for command */ 39/* key combination for command */
41#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 40#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/mechmini/rules.mk b/keyboards/mechmini/rules.mk
index d08985827..ed55ae1c4 100644
--- a/keyboards/mechmini/rules.mk
+++ b/keyboards/mechmini/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = atmel-dfu
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/keyboards/minidox/rev1/config.h b/keyboards/minidox/rev1/config.h
index 9799c4199..b7272bdb0 100644
--- a/keyboards/minidox/rev1/config.h
+++ b/keyboards/minidox/rev1/config.h
@@ -26,8 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
26#define MATRIX_ROW_PINS { B2, B6, B4, B5 } 26#define MATRIX_ROW_PINS { B2, B6, B4, B5 }
27#define MATRIX_COL_PINS { F4, D3, D2, D1, D4 } 27#define MATRIX_COL_PINS { F4, D3, D2, D1, D4 }
28 28
29#define CATERINA_BOOTLOADER
30
31#define USE_SERIAL 29#define USE_SERIAL
32 30
33//#define EE_HANDS 31//#define EE_HANDS
diff --git a/keyboards/minidox/rules.mk b/keyboards/minidox/rules.mk
index 0f9d30310..0c3a03bd7 100644
--- a/keyboards/minidox/rules.mk
+++ b/keyboards/minidox/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/mitosis/rules.mk b/keyboards/mitosis/rules.mk
index 903edb109..0db144ed3 100644
--- a/keyboards/mitosis/rules.mk
+++ b/keyboards/mitosis/rules.mk
@@ -1,6 +1,5 @@
1 1
2OPT_DEFS += -DMITOSIS_PROMICRO 2OPT_DEFS += -DMITOSIS_PROMICRO
3OPT_DEFS += -DCATERINA_BOOTLOADER
4MITOSIS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ 3MITOSIS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
5 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) 4 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
6 5
@@ -25,7 +24,6 @@ MCU = atmega32u4
25# software delays. 24# software delays.
26F_CPU = 16000000 25F_CPU = 16000000
27 26
28
29# 27#
30# LUFA specific 28# LUFA specific
31# 29#
@@ -45,19 +43,15 @@ ARCH = AVR8
45# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 43# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
46F_USB = $(F_CPU) 44F_USB = $(F_CPU)
47 45
46# Bootloader
47# This definition is optional, and if your keyboard supports multiple bootloaders of
48# different sizes, comment this out, and the correct address will be loaded
49# automatically (+60). See bootloader.mk for all options.
50BOOTLOADER = caterina
51
48# Interrupt driven control endpoint task(+60) 52# Interrupt driven control endpoint task(+60)
49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 53OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
50 54
51
52# Boot Section Size in *bytes*
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58OPT_DEFS += -DBOOTLOADER_SIZE=4096
59
60
61# Build Options 55# Build Options
62# comment out to disable the options. 56# comment out to disable the options.
63# 57#
diff --git a/keyboards/mt40/config.h b/keyboards/mt40/config.h
index 394cc7898..6c82b2c74 100644
--- a/keyboards/mt40/config.h
+++ b/keyboards/mt40/config.h
@@ -44,7 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44#define RGBLIGHT_VAL_STEP 18 44#define RGBLIGHT_VAL_STEP 18
45 45
46#define NO_UART 1 46#define NO_UART 1
47#define BOOTLOADHID_BOOTLOADER 1
48 47
49#define TAPPING_TERM 200 48#define TAPPING_TERM 200
50 49
diff --git a/keyboards/mt40/program b/keyboards/mt40/program
deleted file mode 100755
index e8786f566..000000000
--- a/keyboards/mt40/program
+++ /dev/null
@@ -1,74 +0,0 @@
1#!/usr/bin/env python2.7
2# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from __future__ import print_function
18
19import os
20import sys
21import time
22import usb
23
24if len(sys.argv) < 2:
25 print('Usage: %s <firmware.hex>' % sys.argv[0])
26 sys.exit(1)
27
28print('Searching for planck clone keyboard... ', end='')
29
30dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
31if dev is None:
32 raise ValueError('Device not found')
33
34print('Found', end='\n\n')
35
36print('Device Information:')
37print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
38print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
39print('Manufacturer: %s' % (dev.iManufacturer))
40print('Serial: %s' % (dev.iSerialNumber))
41print('Product: %s' % (dev.iProduct), end='\n\n')
42
43print('Transferring control to bootloader... ', end='')
44
45dev.set_configuration()
46
47request_type = usb.util.build_request_type(
48 usb.util.CTRL_OUT,
49 usb.util.CTRL_TYPE_CLASS,
50 usb.util.CTRL_RECIPIENT_DEVICE)
51
52USBRQ_HID_SET_REPORT = 0x09
53HID_REPORT_OPTION = 0x0301
54
55
56try:
57 dev.ctrl_transfer(
58 request_type,
59 USBRQ_HID_SET_REPORT,
60 HID_REPORT_OPTION,
61 0,
62 [0, 0, 0xFF] + [0] * 5
63 )
64except usb.core.USBError:
65 # for some reason I keep getting USBError, but it works!
66 pass
67
68# wait a bit until bootloader starts up
69time.sleep(2)
70
71print('OK')
72print('Programming...')
73if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
74 print('\nDone!')
diff --git a/keyboards/mt40/rules.mk b/keyboards/mt40/rules.mk
index 10023da0e..9d230d238 100644
--- a/keyboards/mt40/rules.mk
+++ b/keyboards/mt40/rules.mk
@@ -9,6 +9,12 @@ NO_SUSPEND_POWER_DOWN = yes
9# processor frequency 9# processor frequency
10F_CPU = 12000000 10F_CPU = 12000000
11 11
12# Bootloader
13# This definition is optional, and if your keyboard supports multiple bootloaders of
14# different sizes, comment this out, and the correct address will be loaded
15# automatically (+60). See bootloader.mk for all options.
16BOOTLOADER = bootloadHID
17
12# build options 18# build options
13BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) 19BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
14MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) 20MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
@@ -26,11 +32,10 @@ RGBLIGHT_CUSTOM_DRIVER = yes
26TAP_DANCE_ENABLE = no 32TAP_DANCE_ENABLE = no
27 33
28OPT_DEFS = -DDEBUG_LEVEL=0 34OPT_DEFS = -DDEBUG_LEVEL=0
29OPT_DEFS += -DBOOTLOADER_SIZE=2048
30 35
31# custom matrix setup 36# custom matrix setup
32CUSTOM_MATRIX = yes 37CUSTOM_MATRIX = yes
33SRC = matrix.c i2c.c 38SRC = matrix.c i2c.c
34 39
35# programming options 40# programming options
36PROGRAM_CMD = ./keyboards/mt40/program $(TARGET).hex 41PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
diff --git a/keyboards/nyquist/rev1/config.h b/keyboards/nyquist/rev1/config.h
index 361576887..4430f254c 100644
--- a/keyboards/nyquist/rev1/config.h
+++ b/keyboards/nyquist/rev1/config.h
@@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } 37#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 }
38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } 38#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
39 39
40#define CATERINA_BOOTLOADER
41
42/* COL2ROW or ROW2COL */ 40/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW 41#define DIODE_DIRECTION COL2ROW
44 42
diff --git a/keyboards/nyquist/rules.mk b/keyboards/nyquist/rules.mk
index f2bc59cc5..971cd188a 100644
--- a/keyboards/nyquist/rules.mk
+++ b/keyboards/nyquist/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/orthodox/rev1/config.h b/keyboards/orthodox/rev1/config.h
index 26715f409..d6564f281 100644
--- a/keyboards/orthodox/rev1/config.h
+++ b/keyboards/orthodox/rev1/config.h
@@ -51,8 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
51#define MATRIX_COL_PINS { D2, F5, F6, F7, B6, B5, B4, D7, D6 } 51#define MATRIX_COL_PINS { D2, F5, F6, F7, B6, B5, B4, D7, D6 }
52/*/ 52/*/
53 53
54#define CATERINA_BOOTLOADER
55
56/* COL2ROW or ROW2COL */ 54/* COL2ROW or ROW2COL */
57#define DIODE_DIRECTION COL2ROW 55#define DIODE_DIRECTION COL2ROW
58 56
diff --git a/keyboards/orthodox/rules.mk b/keyboards/orthodox/rules.mk
index 48d6551bc..d7ea0d49d 100644
--- a/keyboards/orthodox/rules.mk
+++ b/keyboards/orthodox/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/pearl/config.h b/keyboards/pearl/config.h
index 99a93ee79..47a732f76 100644
--- a/keyboards/pearl/config.h
+++ b/keyboards/pearl/config.h
@@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
27#define DESCRIPTION 40% keyboard 27#define DESCRIPTION 40% keyboard
28 28
29#define NO_UART 1 29#define NO_UART 1
30#define BOOTLOADHID_BOOTLOADER 1
31 30
32#define RGBLIGHT_ANIMATIONS 31#define RGBLIGHT_ANIMATIONS
33#define RGBLED_NUM 12 32#define RGBLED_NUM 12
diff --git a/keyboards/pearl/rules.mk b/keyboards/pearl/rules.mk
index d08985827..9165de424 100644
--- a/keyboards/pearl/rules.mk
+++ b/keyboards/pearl/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = bootloadHID
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/keyboards/planck/light/rules.mk b/keyboards/planck/light/rules.mk
index 02c39c43a..1225a5d28 100644
--- a/keyboards/planck/light/rules.mk
+++ b/keyboards/planck/light/rules.mk
@@ -4,6 +4,4 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
4NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 4NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
5BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 5BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
6 6
7OPT_DEFS += -DBOOTLOADER_SIZE=8192
8
9MCU = at90usb1286 \ No newline at end of file 7MCU = at90usb1286 \ No newline at end of file
diff --git a/keyboards/planck/rev3/rules.mk b/keyboards/planck/rev3/rules.mk
index 9ecde5958..e51af55c6 100644
--- a/keyboards/planck/rev3/rules.mk
+++ b/keyboards/planck/rev3/rules.mk
@@ -1,10 +1 @@
1
2# Boot Section Size in *bytes*
3# Teensy halfKay 512
4# Teensy++ halfKay 1024
5# Atmel DFU loader 4096
6# LUFA bootloader 4096
7# USBaspLoader 2048
8OPT_DEFS += -DBOOTLOADER_SIZE=4096
9
10AUDIO_ENABLE = no # Audio output on port C6 AUDIO_ENABLE = no # Audio output on port C6
diff --git a/keyboards/planck/rev4/rules.mk b/keyboards/planck/rev4/rules.mk
index 0001fb50f..7e64e7edc 100644
--- a/keyboards/planck/rev4/rules.mk
+++ b/keyboards/planck/rev4/rules.mk
@@ -1,9 +1 @@
1# Boot Section Size in *bytes*
2# Teensy halfKay 512
3# Teensy++ halfKay 1024
4# Atmel DFU loader 4096
5# LUFA bootloader 4096
6# USBaspLoader 2048
7OPT_DEFS += -DBOOTLOADER_SIZE=4096
8
9AUDIO_ENABLE = yes # Audio output on port C6 AUDIO_ENABLE = yes # Audio output on port C6
diff --git a/keyboards/planck/rev5/rules.mk b/keyboards/planck/rev5/rules.mk
index 29eae4b49..3b22e0a01 100644
--- a/keyboards/planck/rev5/rules.mk
+++ b/keyboards/planck/rev5/rules.mk
@@ -1,9 +1 @@
1# Boot Section Size in *bytes*
2# Teensy halfKay 512
3# Teensy++ halfKay 1024
4# Atmel DFU loader 4096
5# LUFA bootloader 4096
6# USBaspLoader 2048
7OPT_DEFS += -DBOOTLOADER_SIZE=4096
8
9AUDIO_ENABLE = yes # Audio output on port C6 \ No newline at end of file AUDIO_ENABLE = yes # Audio output on port C6 \ No newline at end of file
diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk
index 1fed5fa58..439f7db64 100644
--- a/keyboards/planck/rules.mk
+++ b/keyboards/planck/rules.mk
@@ -34,6 +34,23 @@ ARCH = AVR8
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU) 35F_USB = $(F_CPU)
36 36
37# Bootloader
38# This definition is optional, and if your keyboard supports multiple bootloaders of
39# different sizes, comment this out, and the correct address will be loaded
40# automatically (+60). See bootloader.mk for all options.
41ifeq ($(strip $(KEYBOARD)), planck/rev3)
42 BOOTLOADER = atmel-dfu
43endif
44ifeq ($(strip $(KEYBOARD)), planck/rev4)
45 BOOTLOADER = atmel-dfu
46endif
47ifeq ($(strip $(KEYBOARD)), planck/rev5)
48 BOOTLOADER = qmk-dfu
49endif
50ifeq ($(strip $(KEYBOARD)), planck/light)
51 BOOTLOADER = qmk-dfu
52endif
53
37# Interrupt driven control endpoint task(+60) 54# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 55OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39 56
@@ -46,9 +63,9 @@ MOUSEKEY_ENABLE = no # Mouse keys(+4700)
46EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 63EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
47CONSOLE_ENABLE = yes # Console for debug(+400) 64CONSOLE_ENABLE = yes # Console for debug(+400)
48COMMAND_ENABLE = no # Commands for debug and configuration 65COMMAND_ENABLE = no # Commands for debug and configuration
49NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 66NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
50BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 67BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
51MIDI_ENABLE = no # MIDI controls 68MIDI_ENABLE = yes # MIDI controls
52AUDIO_ENABLE = yes # Audio output on port C6 69AUDIO_ENABLE = yes # Audio output on port C6
53UNICODE_ENABLE = no # Unicode 70UNICODE_ENABLE = no # Unicode
54BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 71BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
diff --git a/keyboards/preonic/rules.mk b/keyboards/preonic/rules.mk
index acef4d971..60087e978 100644
--- a/keyboards/preonic/rules.mk
+++ b/keyboards/preonic/rules.mk
@@ -36,18 +36,20 @@ ARCH = AVR8
36# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 36# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
37F_USB = $(F_CPU) 37F_USB = $(F_CPU)
38 38
39# Bootloader
40# This definition is optional, and if your keyboard supports multiple bootloaders of
41# different sizes, comment this out, and the correct address will be loaded
42# automatically (+60). See bootloader.mk for all options.
43ifeq ($(strip $(KEYBOARD)), preonic/rev1)
44 BOOTLOADER = atmel-dfu
45endif
46ifeq ($(strip $(KEYBOARD)), preonic/rev2)
47 BOOTLOADER = qmk-dfu
48endif
49
39# Interrupt driven control endpoint task(+60) 50# Interrupt driven control endpoint task(+60)
40OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 51OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
41 52
42
43# Boot Section Size in *bytes*
44# Teensy halfKay 512
45# Teensy++ halfKay 1024
46# Atmel DFU loader 4096
47# LUFA bootloader 4096
48# USBaspLoader 2048
49OPT_DEFS += -DBOOTLOADER_SIZE=4096
50
51# Build Options 53# Build Options
52# change to "no" to disable the options, or define them in the Makefile in 54# change to "no" to disable the options, or define them in the Makefile in
53# the appropriate keymap folder that will get included automatically 55# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/ps2avrGB/config.h b/keyboards/ps2avrGB/config.h
index 57ec98519..f62de1653 100644
--- a/keyboards/ps2avrGB/config.h
+++ b/keyboards/ps2avrGB/config.h
@@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
27#define RGBLIGHT_ANIMATIONS 27#define RGBLIGHT_ANIMATIONS
28 28
29#define NO_UART 1 29#define NO_UART 1
30#define BOOTLOADHID_BOOTLOADER 1
31 30
32/* key combination for command */ 31/* key combination for command */
33#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 32#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/ps2avrGB/rules.mk b/keyboards/ps2avrGB/rules.mk
index 9e76993c4..c7c12dcf1 100644
--- a/keyboards/ps2avrGB/rules.mk
+++ b/keyboards/ps2avrGB/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = atmel-dfu
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/keyboards/viterbi/rev1/config.h b/keyboards/viterbi/rev1/config.h
index 68ca5f362..3400ea31a 100644
--- a/keyboards/viterbi/rev1/config.h
+++ b/keyboards/viterbi/rev1/config.h
@@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } 37#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 }
38#define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 } 38#define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 }
39 39
40#define CATERINA_BOOTLOADER
41
42/* COL2ROW or ROW2COL */ 40/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW 41#define DIODE_DIRECTION COL2ROW
44 42
diff --git a/keyboards/viterbi/rules.mk b/keyboards/viterbi/rules.mk
index 8a1b94013..1f77c6374 100644
--- a/keyboards/viterbi/rules.mk
+++ b/keyboards/viterbi/rules.mk
@@ -39,18 +39,15 @@ ARCH = AVR8
39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. 39# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
40F_USB = $(F_CPU) 40F_USB = $(F_CPU)
41 41
42# Bootloader
43# This definition is optional, and if your keyboard supports multiple bootloaders of
44# different sizes, comment this out, and the correct address will be loaded
45# automatically (+60). See bootloader.mk for all options.
46BOOTLOADER = caterina
47
42# Interrupt driven control endpoint task(+60) 48# Interrupt driven control endpoint task(+60)
43OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 49OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
44 50
45
46# Boot Section Size in *bytes*
47# Teensy halfKay 512
48# Teensy++ halfKay 1024
49# Atmel DFU loader 4096
50# LUFA bootloader 4096
51# USBaspLoader 2048
52OPT_DEFS += -DBOOTLOADER_SIZE=4096
53
54# Build Options 51# Build Options
55# change to "no" to disable the options, or define them in the Makefile in 52# change to "no" to disable the options, or define them in the Makefile in
56# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
diff --git a/keyboards/ymd96/config.h b/keyboards/ymd96/config.h
index cdc403d5e..e0a2aa138 100644
--- a/keyboards/ymd96/config.h
+++ b/keyboards/ymd96/config.h
@@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35#define RGBLIGHT_ANIMATIONS 35#define RGBLIGHT_ANIMATIONS
36 36
37#define NO_UART 1 37#define NO_UART 1
38#define BOOTLOADHID_BOOTLOADER 1
39 38
40/* key combination for command */ 39/* key combination for command */
41#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 40#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/ymd96/rules.mk b/keyboards/ymd96/rules.mk
index 9e76993c4..c7c12dcf1 100644
--- a/keyboards/ymd96/rules.mk
+++ b/keyboards/ymd96/rules.mk
@@ -24,6 +24,12 @@ NO_SUSPEND_POWER_DOWN = yes
24# processor frequency 24# processor frequency
25F_CPU = 12000000 25F_CPU = 12000000
26 26
27# Bootloader
28# This definition is optional, and if your keyboard supports multiple bootloaders of
29# different sizes, comment this out, and the correct address will be loaded
30# automatically (+60). See bootloader.mk for all options.
31BOOTLOADER = atmel-dfu
32
27# build options 33# build options
28BOOTMAGIC_ENABLE = yes 34BOOTMAGIC_ENABLE = yes
29MOUSEKEY_ENABLE = yes 35MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
35RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
36 42
37OPT_DEFS = -DDEBUG_LEVEL=0 43OPT_DEFS = -DDEBUG_LEVEL=0
38OPT_DEFS += -DBOOTLOADER_SIZE=2048
39 44
40# custom matrix setup 45# custom matrix setup
41CUSTOM_MATRIX = yes 46CUSTOM_MATRIX = yes
diff --git a/layouts/community/ergodox/jackhumbert/keymap.c b/layouts/community/ergodox/jackhumbert/keymap.c
index 6a00ffa29..634e4a0ce 100644
--- a/layouts/community/ergodox/jackhumbert/keymap.c
+++ b/layouts/community/ergodox/jackhumbert/keymap.c
@@ -19,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 KC_HOME, 19 KC_HOME,
20 KC_SPC,KC_SPC,KC_END, 20 KC_SPC,KC_SPC,KC_END,
21 // right hand 21 // right hand
22 KC_NO, M(1), KC_7, KC_8, KC_9, KC_0, KC_NO, 22 KC_NO, M(1), RESET, KC_8, KC_9, KC_0, KC_NO,
23 KC_NO, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_P, KC_BSPC, 23 KC_NO, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_P, KC_BSPC,
24 RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_SCLN, KC_QUOT, 24 RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_SCLN, KC_QUOT,
25 KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, 25 KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT,
diff --git a/message.mk b/message.mk
index 0548fe174..7c832b292 100644
--- a/message.mk
+++ b/message.mk
@@ -43,9 +43,9 @@ MSG_SIZE_BEFORE = Size before:
43MSG_SIZE_AFTER = Size after: 43MSG_SIZE_AFTER = Size after:
44MSG_COFF = Converting to AVR COFF: 44MSG_COFF = Converting to AVR COFF:
45MSG_EXTENDED_COFF = Converting to AVR Extended COFF: 45MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
46MSG_FLASH = Creating load file for Flash: 46MSG_FLASH = Creating load file for flashing:
47MSG_EEPROM = Creating load file for EEPROM: 47MSG_EEPROM = Creating load file for EEPROM:
48MSG_BIN = Creating binary load file for Flash: 48MSG_BIN = Creating binary load file for flashing:
49MSG_EXTENDED_LISTING = Creating Extended Listing: 49MSG_EXTENDED_LISTING = Creating Extended Listing:
50MSG_SYMBOL_TABLE = Creating Symbol Table: 50MSG_SYMBOL_TABLE = Creating Symbol Table:
51MSG_LINKING = Linking: 51MSG_LINKING = Linking:
@@ -76,3 +76,7 @@ define GENERATE_MSG_MAKE_TEST
76endef 76endef
77MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL) 77MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
78MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR) 78MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
79MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex
80MSG_FILE_TOO_BIG = $(ERROR_COLOR)Your file is too big!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE)\n
81MSG_FILE_TOO_SMALL = Your file is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
82MSG_FILE_JUST_RIGHT = File size is fine - $(CURRENT_SIZE)/$(MAX_SIZE)\n
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 099201596..9232cf441 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -143,7 +143,8 @@ void reset_keyboard(void) {
143#else 143#else
144 wait_ms(250); 144 wait_ms(250);
145#endif 145#endif
146#ifdef CATERINA_BOOTLOADER 146// this is also done later in bootloader.c - not sure if it's neccesary here
147#ifdef BOOTLOADER_CATERINA
147 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific 148 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
148#endif 149#endif
149 bootloader_jump(); 150 bootloader_jump();
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 94e9a7bdb..c083f6b72 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -121,22 +121,22 @@ qmk: $(BUILD_DIR)/$(TARGET).hex
121 printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk 121 printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk
122 122
123# Program the device. 123# Program the device.
124program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep 124program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep check-size
125 $(PROGRAM_CMD) 125 $(PROGRAM_CMD)
126 126
127teensy: $(BUILD_DIR)/$(TARGET).hex 127teensy: $(BUILD_DIR)/$(TARGET).hex check-size
128 $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex 128 $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex
129 129
130BATCHISP ?= batchisp 130BATCHISP ?= batchisp
131 131
132flip: $(BUILD_DIR)/$(TARGET).hex 132flip: $(BUILD_DIR)/$(TARGET).hex check-size
133 $(BATCHISP) -hardware usb -device $(MCU) -operation erase f 133 $(BATCHISP) -hardware usb -device $(MCU) -operation erase f
134 $(BATCHISP) -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program 134 $(BATCHISP) -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
135 $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0 135 $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0
136 136
137DFU_PROGRAMMER ?= dfu-programmer 137DFU_PROGRAMMER ?= dfu-programmer
138 138
139dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter 139dfu: $(BUILD_DIR)/$(TARGET).hex check-size
140 until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\ 140 until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\
141 echo "Error: Bootloader not found. Trying again in 5s." ;\ 141 echo "Error: Bootloader not found. Trying again in 5s." ;\
142 sleep 5 ;\ 142 sleep 5 ;\
@@ -168,7 +168,7 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
168 fi 168 fi
169 $(DFU_PROGRAMMER) $(MCU) reset 169 $(DFU_PROGRAMMER) $(MCU) reset
170 170
171avrdude: $(BUILD_DIR)/$(TARGET).hex 171avrdude: $(BUILD_DIR)/$(TARGET).hex check-size
172 if grep -q -s Microsoft /proc/version; then \ 172 if grep -q -s Microsoft /proc/version; then \
173 echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \ 173 echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \
174 else \ 174 else \
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index 34db8d0b0..ee150817c 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -6,6 +6,7 @@
6#include <avr/wdt.h> 6#include <avr/wdt.h>
7#include <util/delay.h> 7#include <util/delay.h>
8#include "bootloader.h" 8#include "bootloader.h"
9#include <avr/boot.h>
9 10
10#ifdef PROTOCOL_LUFA 11#ifdef PROTOCOL_LUFA
11#include <LUFA/Drivers/USB/USB.h> 12#include <LUFA/Drivers/USB/USB.h>
@@ -56,14 +57,17 @@
56 * | Bootloader | 512B | Bootloader | 1KB 57 * | Bootloader | 512B | Bootloader | 1KB
57 * 0x7FFF +---------------+ 0x1FFFF +---------------+ 58 * 0x7FFF +---------------+ 0x1FFFF +---------------+
58 */ 59 */
59#ifndef BOOTLOADER_SIZE
60#warning To use bootloader_jump() you need to define BOOTLOADER_SIZE in config.h.
61#define BOOTLOADER_SIZE 4096
62#endif
63 60
64#define FLASH_SIZE (FLASHEND + 1L) 61#define FLASH_SIZE (FLASHEND + 1L)
65#define BOOTLOADER_START (FLASH_SIZE - BOOTLOADER_SIZE) 62
63#if !defined(BOOTLOADER_SIZE)
64 uint16_t bootloader_start;
65#endif
66 66
67#define BOOT_SIZE_256 0b110
68#define BOOT_SIZE_512 0b100
69#define BOOT_SIZE_1024 0b010
70#define BOOT_SIZE_2048 0b000
67 71
68/* 72/*
69 * Entering the Bootloader via Software 73 * Entering the Bootloader via Software
@@ -74,34 +78,62 @@ uint32_t reset_key __attribute__ ((section (".noinit")));
74 78
75/* initialize MCU status by watchdog reset */ 79/* initialize MCU status by watchdog reset */
76void bootloader_jump(void) { 80void bootloader_jump(void) {
77 #ifndef CATERINA_BOOTLOADER
78
79 #ifdef PROTOCOL_LUFA
80 USB_Disable();
81 cli();
82 _delay_ms(2000);
83 #endif
84
85 #ifdef PROTOCOL_PJRC
86 cli();
87 UDCON = 1;
88 USBCON = (1<<FRZCLK);
89 UCSR1B = 0;
90 _delay_ms(5);
91 #endif
92
93 #ifdef BOOTLOADHID_BOOTLOADER
94 // force bootloadHID to stay in bootloader mode, so that it waits
95 // for a new firmware to be flashed
96 eeprom_write_byte((uint8_t *)1, 0x00);
97 #endif
98 81
99 // watchdog reset 82 #if !defined(BOOTLOADER_SIZE)
100 reset_key = BOOTLOADER_RESET_KEY; 83 uint8_t high_fuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
101 wdt_enable(WDTO_250MS); 84
102 for (;;); 85 if (high_fuse & BOOT_SIZE_256) {
86 bootloader_start = (FLASH_SIZE - 512) >> 1;
87 } else if (high_fuse & BOOT_SIZE_512) {
88 bootloader_start = (FLASH_SIZE - 1024) >> 1;
89 } else if (high_fuse & BOOT_SIZE_1024) {
90 bootloader_start = (FLASH_SIZE - 2048) >> 1;
91 } else {
92 bootloader_start = (FLASH_SIZE - 4096) >> 1;
93 }
94 #endif
103 95
104 #else 96 // Something like this might work, but it compiled larger than the block above
97 // bootloader_start = FLASH_SIZE - (256 << (~high_fuse & 0b110 >> 1));
98
99
100 #if defined(BOOTLOADER_HALFKAY)
101 // http://www.pjrc.com/teensy/jump_to_bootloader.html
102 cli();
103 // disable watchdog, if enabled (it's not)
104 // disable all peripherals
105 // a shutdown call might make sense here
106 UDCON = 1;
107 USBCON = (1<<FRZCLK); // disable USB
108 UCSR1B = 0;
109 _delay_ms(5);
110 #if defined(__AVR_AT90USB162__) // Teensy 1.0
111 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0;
112 TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0;
113 DDRB = 0; DDRC = 0; DDRD = 0;
114 PORTB = 0; PORTC = 0; PORTD = 0;
115 asm volatile("jmp 0x3E00");
116 #elif defined(__AVR_ATmega32U4__) // Teensy 2.0
117 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
118 TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0;
119 DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0;
120 PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
121 asm volatile("jmp 0x7E00");
122 #elif defined(__AVR_AT90USB646__) // Teensy++ 1.0
123 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
124 TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
125 DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
126 PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
127 asm volatile("jmp 0xFC00");
128 #elif defined(__AVR_AT90USB1286__) // Teensy++ 2.0
129 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
130 TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
131 DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
132 PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
133 asm volatile("jmp 0x1FC00");
134 #endif
135
136 #elif defined(BOOTLOADER_CATERINA)
105 // this block may be optional 137 // this block may be optional
106 // TODO: figure it out 138 // TODO: figure it out
107 139
@@ -118,83 +150,65 @@ void bootloader_jump(void) {
118 150
119 while(1) {} // wait for watchdog timer to trigger 151 while(1) {} // wait for watchdog timer to trigger
120 152
153 #else // Assume remaining boards are DFU, even if the flag isn't set
154
155 #ifndef __AVR_ATmega32A__ // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
156 UDCON = 1;
157 USBCON = (1<<FRZCLK); // disable USB
158 UCSR1B = 0;
159 _delay_ms(5); // 5 seems to work fine
160 #endif
161
162 #ifdef BOOTLOADER_BOOTLOADHID
163 // force bootloadHID to stay in bootloader mode, so that it waits
164 // for a new firmware to be flashed
165 eeprom_write_byte((uint8_t *)1, 0x00);
166 #endif
167
168 // watchdog reset
169 reset_key = BOOTLOADER_RESET_KEY;
170 wdt_enable(WDTO_250MS);
171 for (;;);
121 #endif 172 #endif
173
122} 174}
123 175
124#ifdef __AVR_ATmega32A__ 176#ifdef __AVR_ATmega32A__
125// MCUSR is actually called MCUCSR in ATmega32A 177 // MCUSR is actually called MCUCSR in ATmega32A
126#define MCUSR MCUCSR 178 #define MCUSR MCUCSR
127#endif 179#endif
128 180
129/* this runs before main() */ 181/* this runs before main() */
130void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3"))); 182void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
131void bootloader_jump_after_watchdog_reset(void) 183void bootloader_jump_after_watchdog_reset(void)
132{ 184{
133 if ((MCUSR & (1<<WDRF)) && reset_key == BOOTLOADER_RESET_KEY) { 185 #ifndef BOOTLOADER_HALFKAY
134 reset_key = 0; 186 if ((MCUSR & (1<<WDRF)) && reset_key == BOOTLOADER_RESET_KEY) {
187 reset_key = 0;
188
189 // My custom USBasploader requires this to come up.
190 MCUSR = 0;
135 191
136 // My custom USBasploader requires this to come up. 192 // Seems like Teensy halfkay loader requires clearing WDRF and disabling watchdog.
137 MCUSR = 0; 193 MCUSR &= ~(1<<WDRF);
194 wdt_disable();
138 195
139 // Seems like Teensy halfkay loader requires clearing WDRF and disabling watchdog.
140 MCUSR &= ~(1<<WDRF);
141 wdt_disable();
142 196
143 // This is compled into 'icall', address should be in word unit, not byte. 197 // This is compled into 'icall', address should be in word unit, not byte.
144 ((void (*)(void))(BOOTLOADER_START/2))(); 198 #ifdef BOOTLOADER_SIZE
145 } 199 ((void (*)(void))( (FLASH_SIZE - BOOTLOADER_SIZE) >> 1))();
200 #else
201 asm("ijmp" :: "z" (bootloader_start));
202 #endif
203 }
204 #endif
146} 205}
147 206
148 207
149#if 0 208#if 0
150/* Jumping To The Bootloader
151 * http://www.pjrc.com/teensy/jump_to_bootloader.html
152 *
153 * This method doen't work when using LUFA. idk why.
154 * - needs to initialize more regisers or interrupt setting?
155 */
156void bootloader_jump(void) {
157#ifdef PROTOCOL_LUFA
158 USB_Disable();
159 cli();
160 _delay_ms(2000);
161#endif
162
163#ifdef PROTOCOL_PJRC
164 cli();
165 UDCON = 1;
166 USBCON = (1<<FRZCLK);
167 UCSR1B = 0;
168 _delay_ms(5);
169#endif
170
171 /*
172 * Initialize
173 */
174#if defined(__AVR_AT90USB162__)
175 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0;
176 TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0;
177 DDRB = 0; DDRC = 0; DDRD = 0;
178 PORTB = 0; PORTC = 0; PORTD = 0;
179#elif defined(__AVR_ATmega32U4__)
180 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
181 TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0;
182 DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0;
183 PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
184#elif defined(__AVR_AT90USB646__)
185 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
186 TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
187 DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
188 PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
189#elif defined(__AVR_AT90USB1286__)
190 EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
191 TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
192 DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
193 PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
194#endif
195
196 /* 209 /*
197 * USBaspLoader 210 * USBaspLoader - I'm not sure if this is used at all in any projects
211 * would love to support it if it is -Jack
198 */ 212 */
199#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) 213#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
200 // This makes custom USBasploader come up. 214 // This makes custom USBasploader come up.
diff --git a/tmk_core/common/avr/bootloader_size.c b/tmk_core/common/avr/bootloader_size.c
new file mode 100644
index 000000000..0d8d534f8
--- /dev/null
+++ b/tmk_core/common/avr/bootloader_size.c
@@ -0,0 +1,20 @@
1// Copyright 2017 Jack Humbert
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 2 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#include <avr/io.h>
17#include <avr/boot.h>
18
19// this is not valid C - it's for computing the size available on the chip
20AVR_SIZE: FLASHEND + 1 - BOOTLOADER_SIZE \ No newline at end of file
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 53e79ef47..920a7f6ad 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -216,6 +216,9 @@ MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
216 216
217elf: $(BUILD_DIR)/$(TARGET).elf 217elf: $(BUILD_DIR)/$(TARGET).elf
218hex: $(BUILD_DIR)/$(TARGET).hex 218hex: $(BUILD_DIR)/$(TARGET).hex
219cphex: hex
220 $(SILENT) || printf "Copying $(TARGET).hex to qmk_firmware folder" | $(AWK_CMD)
221 $(COPY) $(BUILD_DIR)/$(TARGET).hex $(TARGET).hex && $(PRINT_OK)
219eep: $(BUILD_DIR)/$(TARGET).eep 222eep: $(BUILD_DIR)/$(TARGET).eep
220lss: $(BUILD_DIR)/$(TARGET).lss 223lss: $(BUILD_DIR)/$(TARGET).lss
221sym: $(BUILD_DIR)/$(TARGET).sym 224sym: $(BUILD_DIR)/$(TARGET).sym
@@ -223,19 +226,17 @@ LIBNAME=lib$(TARGET).a
223lib: $(LIBNAME) 226lib: $(LIBNAME)
224 227
225# Display size of file. 228# Display size of file.
226HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex 229HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
227#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf 230#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
228ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf 231ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
229 232
230sizebefore: 233sizebefore:
231 @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \ 234 @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
232 2>/dev/null; $(SECHO); fi 235 2>/dev/null; $(SECHO); fi
233 236
234sizeafter: $(BUILD_DIR)/$(TARGET).hex 237sizeafter: $(BUILD_DIR)/$(TARGET).hex
235 @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \ 238 @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
236 2>/dev/null; $(SECHO); fi 239 2>/dev/null; $(SECHO); fi
237 # test file sizes eventually
238 # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | $(AWK) 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi
239 240
240# Display compiler version information. 241# Display compiler version information.
241gccversion : 242gccversion :
@@ -249,8 +250,6 @@ gccversion :
249 @if $(AUTOGEN); then \ 250 @if $(AUTOGEN); then \
250 $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(TARGET).hex\n"; \ 251 $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(TARGET).hex\n"; \
251 $(COPY) $@ $(KEYMAP_PATH)/$(TARGET).hex; \ 252 $(COPY) $@ $(KEYMAP_PATH)/$(TARGET).hex; \
252 else \
253 $(COPY) $@ $(TARGET).hex; \
254 fi 253 fi
255 254
256%.eep: %.elf 255%.eep: %.elf
@@ -371,6 +370,14 @@ show_path:
371 @echo SRC=$(SRC) 370 @echo SRC=$(SRC)
372 @echo OBJ=$(OBJ) 371 @echo OBJ=$(OBJ)
373 372
373check-size:
374 $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | grep -oP "(?<=AVR_SIZE: ).+"`; echo $$(($$n)) || echo 0))
375 $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
376 if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
377 $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
378 if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then $(PRINT_WARNING_PLAIN); $(SILENT) || printf " * $(MSG_FILE_TOO_BIG)" ; else $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; fi \
379 fi
380
374# Create build directory 381# Create build directory
375$(shell mkdir -p $(BUILD_DIR) 2>/dev/null) 382$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
376 383
@@ -385,4 +392,4 @@ $(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
385.PHONY : all finish sizebefore sizeafter qmkversion \ 392.PHONY : all finish sizebefore sizeafter qmkversion \
386gccversion build elf hex eep lss sym coff extcoff \ 393gccversion build elf hex eep lss sym coff extcoff \
387clean clean_list debug gdb-config show_path \ 394clean clean_list debug gdb-config show_path \
388program teensy dfu flip dfu-ee flip-ee dfu-start 395program teensy dfu flip dfu-ee flip-ee dfu-start \ No newline at end of file
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 31f58a430..1bf029163 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -428,7 +428,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
428 case KC_MAKE: 428 case KC_MAKE:
429 if (!record->event.pressed) { 429 if (!record->event.pressed) {
430 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP); 430 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
431#ifndef CATERINA_BOOTLOADER 431#ifndef BOOTLOADER_CATERINA
432 SEND_STRING(":teensy "); 432 SEND_STRING(":teensy ");
433#else 433#else
434 SEND_STRING(" "); 434 SEND_STRING(" ");
diff --git a/users/drashna/template.c b/users/drashna/template.c
index 027c780e9..f377d64f7 100644
--- a/users/drashna/template.c
+++ b/users/drashna/template.c
@@ -43,7 +43,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
43 case KC_MAKE: 43 case KC_MAKE:
44 if (!record->event.pressed) { 44 if (!record->event.pressed) {
45 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP); 45 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
46#ifndef CATERINA_BOOTLOADER 46#ifndef BOOTLOADER_CATERINA
47 SEND_STRING(":teensy "); 47 SEND_STRING(":teensy ");
48#else 48#else
49 SEND_STRING(" "); 49 SEND_STRING(" ");