aboutsummaryrefslogtreecommitdiffstats
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)
downloadfirmware-9fdc27626097ae03b767a09427efc90475d90955.tar.gz
firmware-9fdc27626097ae03b767a09427efc90475d90955.tar.bz2
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 @@
+# Copyright 2017 Jack Humbert
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# If it's possible that multiple bootloaders can be used for one project,
+# you can leave this unset, and the correct size will be selected
+# automatically.
+#
+# Sets the bootloader defined in the keyboard's/keymap's rules.mk
+# Current options:
+# atmel-dfu
+# lufa-dfu
+# qmk-dfu
+# halfkay
+# caterina
+# bootloadHID
+#
+# BOOTLOADER_SIZE can still be defined manually, but it's recommended
+# you add any possible configuration to this list
+
+ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
+ OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ BOOTLOADER_SIZE = 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
+ OPT_DEFS += -DBOOTLOADER_LUFA_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ BOOTLOADER_SIZE = 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
+ OPT_DEFS += -DBOOTLOADER_QMK_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ BOOTLOADER_SIZE = 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), halfkay)
+ OPT_DEFS += -DBOOTLOADER_HALFKAY
+ BOOTLOADER_SIZE = 512
+endif
+ifeq ($(strip $(BOOTLOADER)), caterina)
+ OPT_DEFS += -DBOOTLOADER_CATERINA
+ BOOTLOADER_SIZE = 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), bootloadHID)
+ OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
+ BOOTLOADER_SIZE = 4096
+endif
+
+ifdef BOOTLOADER_SIZE
+ OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
+endif \ 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)
include common_features.mk
include $(TMK_PATH)/protocol.mk
include $(TMK_PATH)/common.mk
+include bootloader.mk
SRC += $(TMK_COMMON_SRC)
OPT_DEFS += $(TMK_COMMON_DEFS)
@@ -266,10 +267,10 @@ $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
# Default target.
-all: build sizeafter
+all: build check-size
# Change the build target to build a HEX file or a library.
-build: elf hex
+build: elf cphex
#build: elf hex eep lss sym
#build: lib
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 @@
-# Flashing Intrustructions
+# Flashing Intrustructions / Bootloader Information
There 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.
+If 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`.
+
## DFU
Atmel'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.
-These bootloaders are usually 4096 bytes for the atmega32u4 chip.
+To ensure compatability with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
+
+ # Bootloader
+ # This definition is optional, and if your keyboard supports multiple bootloaders of
+ # different sizes, comment this out, and the correct address will be loaded
+ # automatically (+60). See bootloader.mk for all options.
+ BOOTLOADER = atmel-dfu
Compatible flashers:
@@ -26,15 +34,32 @@ or:
make <keyboard>:<keymap>:dfu
+### QMK DFU
+
+QMK 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):
+
+ #define QMK_ESC_OUTPUT F1 // usually COL
+ #define QMK_ESC_INPUT D5 // usually ROW
+ #define QMK_LED E6
+ #define QMK_SPEAKER C6
+
+The Manufacturer and Product names are automatically pulled from your `config.h`, and "Bootloader" is added to the product.
+
+To generate this bootloader, use the `bootloader` target, eg `make planck/rev4:default:bootloader`.
+
+To generate a production-ready .hex file (containing the application and the bootloader), use the `production` target, eg `make planck/rev4:default:production`.
+
## Caterina
Arduino 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.
-This block of code allows for Caterina compatibility in QMK:
+To ensure compatability with the Caterina bootloader, make sure this block is present your `rules.mk`:
- #define CATERINA_BOOTLOADER
-
-These bootloaders are usually 4096 bytes for the atmega32u4 chip.
+ # Bootloader
+ # This definition is optional, and if your keyboard supports multiple bootloaders of
+ # different sizes, comment this out, and the correct address will be loaded
+ # automatically (+60). See bootloader.mk for all options.
+ BOOTLOADER = caterina
Compatible flashers:
@@ -57,7 +82,13 @@ or
Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).
-This bootloader is 512 bytes.
+To ensure compatability with the Halfkay bootloader, make sure this block is present your `rules.mk`:
+
+ # Bootloader
+ # This definition is optional, and if your keyboard supports multiple bootloaders of
+ # different sizes, comment this out, and the correct address will be loaded
+ # automatically (+60). See bootloader.mk for all options.
+ BOOTLOADER = halfkay
Compatible flashers:
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
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
OPT_DEFS += -DATREUS_ASTAR
- OPT_DEFS += -DCATERINA_BOOTLOADER
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
@@ -27,7 +26,6 @@ MCU = atmega32u4
# software delays.
F_CPU = 16000000
-
#
# LUFA specific
#
@@ -47,19 +45,20 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+ifdef TEENSY2
+ BOOTLOADER = halfkay
+else
+ BOOTLOADER = caterina
+endif
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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/>.
#define MATRIX_ROW_PINS { D2, D3, D1, D0, D4 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, C6 }
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define RGBLIGHT_ANIMATIONS
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = bootloadHID
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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/>.
#define RGBLIGHT_ANIMATIONS
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = bootloadHID
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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 @@
OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO
-OPT_DEFS += -DCATERINA_BOOTLOADER
CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
@@ -45,19 +44,15 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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 @@
BLUETOOTH = AdafruitBLE
ADAFRUIT_BLE_ENABLE = yes
-OPT_DEFS += -DCATERINA_BOOTLOADER
F_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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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 @@
OPT_DEFS += -DDICHOTEMY_PROMICRO
-OPT_DEFS += -DCATERINA_BOOTLOADER
DICHOTEMY_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
@@ -25,8 +24,6 @@ MCU = atmega32u4
# software delays.
F_CPU = 16000000
-
-#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
@@ -45,19 +42,15 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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/>.
#define MATRIX_ROWS 4
#define MATRIX_COLS 14
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = halfkay
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=512
-
# If you have Left LEDs (see
# https://geekhack.org/index.php?topic=22780.msg873819#msg873819 for
# 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/>.
#define MATRIX_ROW_PINS { F7, B1, B3, B2, B6 }
#define MATRIX_COL_PINS { B4, E6, D7, F6, D4, D0 }
-#define CATERINA_BOOTLOADER
-
#define UNUSED_PINS
/* 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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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
ifdef ASTAR
CFLAGS=-D ASTAR
- OPT_DEFS += -DBOOTLOADER_SIZE=4096
MCU = atmega32u4
- OPT_DEFS += -DCATERINA_BOOTLOADER
SCULPT_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done ; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
else
MCU = at90usb1286
- OPT_DEFS += -DBOOTLOADER_SIZE=2048
SCULPT_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
endif
F_CPU = 16000000
ARCH = AVR8
F_USB = $(F_CPU)
+
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+ifdef ASTAR
+ BOOTLOADER = caterina
+else
+ BOOTLOADER = atmel-dfu
+endif
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
-
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
ifdef TEENSY2
+ BOOTLOADER = halfkay
OPT_DEFS += -DATREUS_TEENSY2
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
+ BOOTLOADER = caterina
OPT_DEFS += -DATREUS_ASTAR
- OPT_DEFS += -DCATERINA_BOOTLOADER
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-# MCU name
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# 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 @@
#define PRODUCT Space Odyssey
#define DESCRIPTION Keyboard
-#define CATERINA_BOOTLOADER
-
#define MOUSEKEY_INTERVAL 16
#define MOUSEKEY_DELAY 0
#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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
ifdef TEENSY2
+ BOOTLOADER = halfkay
OPT_DEFS += -DATREUS_TEENSY2
ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex
else
+ BOOTLOADER = caterina
OPT_DEFS += -DATREUS_ASTAR
- OPT_DEFS += -DCATERINA_BOOTLOADER
ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
endif
+
+
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
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/>.
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
-#define CATERINA_BOOTLOADER
-
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# change yes to no to disable
#
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/>.
#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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/>.
#define MATRIX_ROW_PINS { D7, E6, B4, D2, D4 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define TAPPING_TOGGLE 3
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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 @@
-#!/usr/bin/env python
-# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import print_function
-
-import os
-import sys
-import time
-import usb
-
-if len(sys.argv) < 2:
- print('Usage: %s <firmware.hex>' % sys.argv[0])
- sys.exit(1)
-
-print('Searching for jj40... ', end='')
-
-dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
-if dev is None:
- raise ValueError('Device not found')
-
-print('Found', end='\n\n')
-
-print('Device Information:')
-print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
-print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
-print('Manufacturer: %s' % (dev.iManufacturer))
-print('Serial: %s' % (dev.iSerialNumber))
-print('Product: %s' % (dev.iProduct), end='\n\n')
-
-print('Transferring control to bootloader... ', end='')
-
-dev.set_configuration()
-
-request_type = usb.util.build_request_type(
- usb.util.CTRL_OUT,
- usb.util.CTRL_TYPE_CLASS,
- usb.util.CTRL_RECIPIENT_DEVICE)
-
-USBRQ_HID_SET_REPORT = 0x09
-HID_REPORT_OPTION = 0x0301
-
-
-try:
- dev.ctrl_transfer(
- request_type,
- USBRQ_HID_SET_REPORT,
- HID_REPORT_OPTION,
- 0,
- [0, 0, 0xFF] + [0] * 5
- )
-except usb.core.USBError:
- # for some reason I keep getting USBError, but it works!
- pass
-
-# wait a bit until bootloader starts up
-time.sleep(2)
-
-print('OK')
-print('Programming...')
-if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
- 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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = bootloadHID
+
# build options
BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = no
@@ -39,11 +45,10 @@ KEY_LOCK_ENABLE = yes
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_MATRIX = yes
SRC = matrix.c i2c.c
# programming options
-PROGRAM_CMD = ./keyboards/jj40/program $(TARGET).hex
+PROGRAM_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/>.
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
// #define MATRIX_COL_PINS { B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order
-
-#define CATERINA_BOOTLOADER
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
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/>.
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
// #define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6 } //uncomment this line and comment line above if you need to reverse left-to-right key order
-#define CATERINA_BOOTLOADER
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define MATRIX_COL_PINS { F4, F7, D7, B3, B2, B6}
// #define MATRIX_COL_PINS { B6, B2, B3, C6, F7, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order
-#define CATERINA_BOOTLOADER
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
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/>.
#define MATRIX_ROW_PINS { D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 }
-#define CATERINA_BOOTLOADER
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
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/>.
#define MATRIX_ROW_PINS { D4, D7, E6, B4 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
-
-#define CATERINA_BOOTLOADER
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define RGB_DI_PIN E2
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = atmel-dfu
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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/>.
#define MATRIX_ROW_PINS { B2, B6, B4, B5 }
#define MATRIX_COL_PINS { F4, D3, D2, D1, D4 }
-#define CATERINA_BOOTLOADER
-
#define USE_SERIAL
//#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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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 @@
OPT_DEFS += -DMITOSIS_PROMICRO
-OPT_DEFS += -DCATERINA_BOOTLOADER
MITOSIS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
@@ -25,7 +24,6 @@ MCU = atmega32u4
# software delays.
F_CPU = 16000000
-
#
# LUFA specific
#
@@ -45,19 +43,15 @@ ARCH = AVR8
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
# Build Options
# comment out to disable the options.
#
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/>.
#define RGBLIGHT_VAL_STEP 18
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
#define TAPPING_TERM 200
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 @@
-#!/usr/bin/env python2.7
-# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import print_function
-
-import os
-import sys
-import time
-import usb
-
-if len(sys.argv) < 2:
- print('Usage: %s <firmware.hex>' % sys.argv[0])
- sys.exit(1)
-
-print('Searching for planck clone keyboard... ', end='')
-
-dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
-if dev is None:
- raise ValueError('Device not found')
-
-print('Found', end='\n\n')
-
-print('Device Information:')
-print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
-print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
-print('Manufacturer: %s' % (dev.iManufacturer))
-print('Serial: %s' % (dev.iSerialNumber))
-print('Product: %s' % (dev.iProduct), end='\n\n')
-
-print('Transferring control to bootloader... ', end='')
-
-dev.set_configuration()
-
-request_type = usb.util.build_request_type(
- usb.util.CTRL_OUT,
- usb.util.CTRL_TYPE_CLASS,
- usb.util.CTRL_RECIPIENT_DEVICE)
-
-USBRQ_HID_SET_REPORT = 0x09
-HID_REPORT_OPTION = 0x0301
-
-
-try:
- dev.ctrl_transfer(
- request_type,
- USBRQ_HID_SET_REPORT,
- HID_REPORT_OPTION,
- 0,
- [0, 0, 0xFF] + [0] * 5
- )
-except usb.core.USBError:
- # for some reason I keep getting USBError, but it works!
- pass
-
-# wait a bit until bootloader starts up
-time.sleep(2)
-
-print('OK')
-print('Programming...')
-if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
- 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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = bootloadHID
+
# build options
BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
@@ -26,11 +32,10 @@ RGBLIGHT_CUSTOM_DRIVER = yes
TAP_DANCE_ENABLE = no
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_MATRIX = yes
SRC = matrix.c i2c.c
# programming options
-PROGRAM_CMD = ./keyboards/mt40/program $(TARGET).hex
+PROGRAM_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/>.
#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define MATRIX_COL_PINS { D2, F5, F6, F7, B6, B5, B4, D7, D6 }
/*/
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define DESCRIPTION 40% keyboard
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
#define RGBLIGHT_ANIMATIONS
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = bootloadHID
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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)
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
-OPT_DEFS += -DBOOTLOADER_SIZE=8192
-
MCU = 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 @@
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
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 @@
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
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 @@
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+ifeq ($(strip $(KEYBOARD)), planck/rev3)
+ BOOTLOADER = atmel-dfu
+endif
+ifeq ($(strip $(KEYBOARD)), planck/rev4)
+ BOOTLOADER = atmel-dfu
+endif
+ifeq ($(strip $(KEYBOARD)), planck/rev5)
+ BOOTLOADER = qmk-dfu
+endif
+ifeq ($(strip $(KEYBOARD)), planck/light)
+ BOOTLOADER = qmk-dfu
+endif
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
@@ -46,9 +63,9 @@ MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-MIDI_ENABLE = no # MIDI controls
+MIDI_ENABLE = yes # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+ifeq ($(strip $(KEYBOARD)), preonic/rev1)
+ BOOTLOADER = atmel-dfu
+endif
+ifeq ($(strip $(KEYBOARD)), preonic/rev2)
+ BOOTLOADER = qmk-dfu
+endif
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define RGBLIGHT_ANIMATIONS
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = atmel-dfu
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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/>.
#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 }
-#define CATERINA_BOOTLOADER
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
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
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = caterina
+
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# 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/>.
#define RGBLIGHT_ANIMATIONS
#define NO_UART 1
-#define BOOTLOADHID_BOOTLOADER 1
/* key combination for command */
#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
# processor frequency
F_CPU = 12000000
+# Bootloader
+# This definition is optional, and if your keyboard supports multiple bootloaders of
+# different sizes, comment this out, and the correct address will be loaded
+# automatically (+60). See bootloader.mk for all options.
+BOOTLOADER = atmel-dfu
+
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -35,7 +41,6 @@ RGBLIGHT_ENABLE = yes
RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
-OPT_DEFS += -DBOOTLOADER_SIZE=2048
# custom matrix setup
CUSTOM_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] = {
KC_HOME,
KC_SPC,KC_SPC,KC_END,
// right hand
- KC_NO, M(1), KC_7, KC_8, KC_9, KC_0, KC_NO,
+ KC_NO, M(1), RESET, KC_8, KC_9, KC_0, KC_NO,
KC_NO, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_P, KC_BSPC,
RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_SCLN, KC_QUOT,
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:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for Flash:
+MSG_FLASH = Creating load file for flashing:
MSG_EEPROM = Creating load file for EEPROM:
-MSG_BIN = Creating binary load file for Flash:
+MSG_BIN = Creating binary load file for flashing:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
@@ -76,3 +76,7 @@ define GENERATE_MSG_MAKE_TEST
endef
MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
+MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex
+MSG_FILE_TOO_BIG = $(ERROR_COLOR)Your file is too big!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE)\n
+MSG_FILE_TOO_SMALL = Your file is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
+MSG_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) {
#else
wait_ms(250);
#endif
-#ifdef CATERINA_BOOTLOADER
+// this is also done later in bootloader.c - not sure if it's neccesary here
+#ifdef BOOTLOADER_CATERINA
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
#endif
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
printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk
# Program the device.
-program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
+program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep check-size
$(PROGRAM_CMD)
-teensy: $(BUILD_DIR)/$(TARGET).hex
+teensy: $(BUILD_DIR)/$(TARGET).hex check-size
$(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex
BATCHISP ?= batchisp
-flip: $(BUILD_DIR)/$(TARGET).hex
+flip: $(BUILD_DIR)/$(TARGET).hex check-size
$(BATCHISP) -hardware usb -device $(MCU) -operation erase f
$(BATCHISP) -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
$(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0
DFU_PROGRAMMER ?= dfu-programmer
-dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
+dfu: $(BUILD_DIR)/$(TARGET).hex check-size
until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\
echo "Error: Bootloader not found. Trying again in 5s." ;\
sleep 5 ;\
@@ -168,7 +168,7 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
fi
$(DFU_PROGRAMMER) $(MCU) reset
-avrdude: $(BUILD_DIR)/$(TARGET).hex
+avrdude: $(BUILD_DIR)/$(TARGET).hex check-size
if grep -q -s Microsoft /proc/version; then \
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.'; \
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 @@
#include <avr/wdt.h>
#include <util/delay.h>
#include "bootloader.h"
+#include <avr/boot.h>
#ifdef PROTOCOL_LUFA
#include <LUFA/Drivers/USB/USB.h>
@@ -56,14 +57,17 @@
* | Bootloader | 512B | Bootloader | 1KB
* 0x7FFF +---------------+ 0x1FFFF +---------------+
*/
-#ifndef BOOTLOADER_SIZE
-#warning To use bootloader_jump() you need to define BOOTLOADER_SIZE in config.h.
-#define BOOTLOADER_SIZE 4096
-#endif
-#define FLASH_SIZE (FLASHEND + 1L)
-#define BOOTLOADER_START (FLASH_SIZE - BOOTLOADER_SIZE)
+#define FLASH_SIZE (FLASHEND + 1L)
+
+#if !defined(BOOTLOADER_SIZE)
+ uint16_t bootloader_start;
+#endif
+#define BOOT_SIZE_256 0b110
+#define BOOT_SIZE_512 0b100
+#define BOOT_SIZE_1024 0b010
+#define BOOT_SIZE_2048 0b000
/*
* Entering the Bootloader via Software
@@ -74,34 +78,62 @@ uint32_t reset_key __attribute__ ((section (".noinit")));
/* initialize MCU status by watchdog reset */
void bootloader_jump(void) {
- #ifndef CATERINA_BOOTLOADER
-
- #ifdef PROTOCOL_LUFA
- USB_Disable();
- cli();
- _delay_ms(2000);
- #endif
-
- #ifdef PROTOCOL_PJRC
- cli();
- UDCON = 1;
- USBCON = (1<<FRZCLK);
- UCSR1B = 0;
- _delay_ms(5);
- #endif
-
- #ifdef BOOTLOADHID_BOOTLOADER
- // force bootloadHID to stay in bootloader mode, so that it waits
- // for a new firmware to be flashed
- eeprom_write_byte((uint8_t *)1, 0x00);
- #endif
- // watchdog reset
- reset_key = BOOTLOADER_RESET_KEY;
- wdt_enable(WDTO_250MS);
- for (;;);
+ #if !defined(BOOTLOADER_SIZE)
+ uint8_t high_fuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
+
+ if (high_fuse & BOOT_SIZE_256) {
+ bootloader_start = (FLASH_SIZE - 512) >> 1;
+ } else if (high_fuse & BOOT_SIZE_512) {
+ bootloader_start = (FLASH_SIZE - 1024) >> 1;
+ } else if (high_fuse & BOOT_SIZE_1024) {
+ bootloader_start = (FLASH_SIZE - 2048) >> 1;
+ } else {
+ bootloader_start = (FLASH_SIZE - 4096) >> 1;
+ }
+ #endif
- #else
+ // Something like this might work, but it compiled larger than the block above
+ // bootloader_start = FLASH_SIZE - (256 << (~high_fuse & 0b110 >> 1));
+
+
+ #if defined(BOOTLOADER_HALFKAY)
+ // http://www.pjrc.com/teensy/jump_to_bootloader.html
+ cli();
+ // disable watchdog, if enabled (it's not)
+ // disable all peripherals
+ // a shutdown call might make sense here
+ UDCON = 1;
+ USBCON = (1<<FRZCLK); // disable USB
+ UCSR1B = 0;
+ _delay_ms(5);
+ #if defined(__AVR_AT90USB162__) // Teensy 1.0
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0;
+ TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0;
+ DDRB = 0; DDRC = 0; DDRD = 0;
+ PORTB = 0; PORTC = 0; PORTD = 0;
+ asm volatile("jmp 0x3E00");
+ #elif defined(__AVR_ATmega32U4__) // Teensy 2.0
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0;
+ DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0;
+ PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+ asm volatile("jmp 0x7E00");
+ #elif defined(__AVR_AT90USB646__) // Teensy++ 1.0
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
+ DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
+ PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+ asm volatile("jmp 0xFC00");
+ #elif defined(__AVR_AT90USB1286__) // Teensy++ 2.0
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
+ DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
+ PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+ asm volatile("jmp 0x1FC00");
+ #endif
+
+ #elif defined(BOOTLOADER_CATERINA)
// this block may be optional
// TODO: figure it out
@@ -118,83 +150,65 @@ void bootloader_jump(void) {
while(1) {} // wait for watchdog timer to trigger
+ #else // Assume remaining boards are DFU, even if the flag isn't set
+
+ #ifndef __AVR_ATmega32A__ // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
+ UDCON = 1;
+ USBCON = (1<<FRZCLK); // disable USB
+ UCSR1B = 0;
+ _delay_ms(5); // 5 seems to work fine
+ #endif
+
+ #ifdef BOOTLOADER_BOOTLOADHID
+ // force bootloadHID to stay in bootloader mode, so that it waits
+ // for a new firmware to be flashed
+ eeprom_write_byte((uint8_t *)1, 0x00);
+ #endif
+
+ // watchdog reset
+ reset_key = BOOTLOADER_RESET_KEY;
+ wdt_enable(WDTO_250MS);
+ for (;;);
#endif
+
}
#ifdef __AVR_ATmega32A__
-// MCUSR is actually called MCUCSR in ATmega32A
-#define MCUSR MCUCSR
+ // MCUSR is actually called MCUCSR in ATmega32A
+ #define MCUSR MCUCSR
#endif
/* this runs before main() */
void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
void bootloader_jump_after_watchdog_reset(void)
{
- if ((MCUSR & (1<<WDRF)) && reset_key == BOOTLOADER_RESET_KEY) {
- reset_key = 0;
+ #ifndef BOOTLOADER_HALFKAY
+ if ((MCUSR & (1<<WDRF)) && reset_key == BOOTLOADER_RESET_KEY) {
+ reset_key = 0;
+
+ // My custom USBasploader requires this to come up.
+ MCUSR = 0;
- // My custom USBasploader requires this to come up.
- MCUSR = 0;
+ // Seems like Teensy halfkay loader requires clearing WDRF and disabling watchdog.
+ MCUSR &= ~(1<<WDRF);
+ wdt_disable();
- // Seems like Teensy halfkay loader requires clearing WDRF and disabling watchdog.
- MCUSR &= ~(1<<WDRF);
- wdt_disable();
- // This is compled into 'icall', address should be in word unit, not byte.
- ((void (*)(void))(BOOTLOADER_START/2))();
- }
+ // This is compled into 'icall', address should be in word unit, not byte.
+ #ifdef BOOTLOADER_SIZE
+ ((void (*)(void))( (FLASH_SIZE - BOOTLOADER_SIZE) >> 1))();
+ #else
+ asm("ijmp" :: "z" (bootloader_start));
+ #endif
+ }
+ #endif
}
#if 0
-/* Jumping To The Bootloader
- * http://www.pjrc.com/teensy/jump_to_bootloader.html
- *
- * This method doen't work when using LUFA. idk why.
- * - needs to initialize more regisers or interrupt setting?
- */
-void bootloader_jump(void) {
-#ifdef PROTOCOL_LUFA
- USB_Disable();
- cli();
- _delay_ms(2000);
-#endif
-
-#ifdef PROTOCOL_PJRC
- cli();
- UDCON = 1;
- USBCON = (1<<FRZCLK);
- UCSR1B = 0;
- _delay_ms(5);
-#endif
-
- /*
- * Initialize
- */
-#if defined(__AVR_AT90USB162__)
- EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0;
- TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0;
- DDRB = 0; DDRC = 0; DDRD = 0;
- PORTB = 0; PORTC = 0; PORTD = 0;
-#elif defined(__AVR_ATmega32U4__)
- EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
- TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0;
- DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0;
- PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
-#elif defined(__AVR_AT90USB646__)
- EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
- TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
- DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
- PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
-#elif defined(__AVR_AT90USB1286__)
- EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
- TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
- DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
- PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
-#endif
-
/*
- * USBaspLoader
+ * USBaspLoader - I'm not sure if this is used at all in any projects
+ * would love to support it if it is -Jack
*/
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
// 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 @@
+// Copyright 2017 Jack Humbert
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include <avr/io.h>
+#include <avr/boot.h>
+
+// this is not valid C - it's for computing the size available on the chip
+AVR_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,$@)
elf: $(BUILD_DIR)/$(TARGET).elf
hex: $(BUILD_DIR)/$(TARGET).hex
+cphex: hex
+ $(SILENT) || printf "Copying $(TARGET).hex to qmk_firmware folder" | $(AWK_CMD)
+ $(COPY) $(BUILD_DIR)/$(TARGET).hex $(TARGET).hex && $(PRINT_OK)
eep: $(BUILD_DIR)/$(TARGET).eep
lss: $(BUILD_DIR)/$(TARGET).lss
sym: $(BUILD_DIR)/$(TARGET).sym
@@ -223,19 +226,17 @@ LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
sizebefore:
- @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
+ @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
2>/dev/null; $(SECHO); fi
sizeafter: $(BUILD_DIR)/$(TARGET).hex
- @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
+ @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
2>/dev/null; $(SECHO); fi
- # test file sizes eventually
- # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | $(AWK) 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi
# Display compiler version information.
gccversion :
@@ -249,8 +250,6 @@ gccversion :
@if $(AUTOGEN); then \
$(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(TARGET).hex\n"; \
$(COPY) $@ $(KEYMAP_PATH)/$(TARGET).hex; \
- else \
- $(COPY) $@ $(TARGET).hex; \
fi
%.eep: %.elf
@@ -371,6 +370,14 @@ show_path:
@echo SRC=$(SRC)
@echo OBJ=$(OBJ)
+check-size:
+ $(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))
+ $(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))
+ if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
+ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
+ 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 \
+ fi
+
# Create build directory
$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
@@ -385,4 +392,4 @@ $(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
.PHONY : all finish sizebefore sizeafter qmkversion \
gccversion build elf hex eep lss sym coff extcoff \
clean clean_list debug gdb-config show_path \
-program teensy dfu flip dfu-ee flip-ee dfu-start
+program 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) {
case KC_MAKE:
if (!record->event.pressed) {
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
-#ifndef CATERINA_BOOTLOADER
+#ifndef BOOTLOADER_CATERINA
SEND_STRING(":teensy ");
#else
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) {
case KC_MAKE:
if (!record->event.pressed) {
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
-#ifndef CATERINA_BOOTLOADER
+#ifndef BOOTLOADER_CATERINA
SEND_STRING(":teensy ");
#else
SEND_STRING(" ");