summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--builddefs/build_keyboard.mk2
-rw-r--r--keyboards/handwired/pytest/basic/rules.mk1
-rw-r--r--keyboards/handwired/pytest/has_community/rules.mk2
-rw-r--r--keyboards/handwired/pytest/has_template/rules.mk1
-rw-r--r--keyboards/handwired/pytest/info.json4
-rw-r--r--keyboards/handwired/pytest/macro/rules.mk1
-rw-r--r--lib/python/qmk/info.py6
-rw-r--r--lib/python/qmk/keymap.py2
-rw-r--r--platforms/arm_atsam/bootloader.mk46
-rw-r--r--platforms/avr/bootloader.mk (renamed from builddefs/bootloader.mk)93
-rw-r--r--platforms/chibios/bootloader.mk122
11 files changed, 180 insertions, 100 deletions
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk
index fe95dcaf15..65bc0451f7 100644
--- a/builddefs/build_keyboard.mk
+++ b/builddefs/build_keyboard.mk
@@ -428,7 +428,6 @@ include $(BUILDDEFS_PATH)/common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/protocol.mk
include $(PLATFORM_PATH)/common.mk
-include $(BUILDDEFS_PATH)/bootloader.mk
SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
@@ -443,6 +442,7 @@ ifneq ($(REQUIRE_PLATFORM_KEY),)
endif
endif
+-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/bootloader.mk
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
diff --git a/keyboards/handwired/pytest/basic/rules.mk b/keyboards/handwired/pytest/basic/rules.mk
index 6b42774dbf..e69de29bb2 100644
--- a/keyboards/handwired/pytest/basic/rules.mk
+++ b/keyboards/handwired/pytest/basic/rules.mk
@@ -1 +0,0 @@
-MCU = atmega32u4
diff --git a/keyboards/handwired/pytest/has_community/rules.mk b/keyboards/handwired/pytest/has_community/rules.mk
index 4161649cbc..051634b3a4 100644
--- a/keyboards/handwired/pytest/has_community/rules.mk
+++ b/keyboards/handwired/pytest/has_community/rules.mk
@@ -1,3 +1 @@
-MCU = atmega32u4
-
LAYOUTS = ortho_1x1
diff --git a/keyboards/handwired/pytest/has_template/rules.mk b/keyboards/handwired/pytest/has_template/rules.mk
index 6b42774dbf..e69de29bb2 100644
--- a/keyboards/handwired/pytest/has_template/rules.mk
+++ b/keyboards/handwired/pytest/has_template/rules.mk
@@ -1 +0,0 @@
-MCU = atmega32u4
diff --git a/keyboards/handwired/pytest/info.json b/keyboards/handwired/pytest/info.json
index 331472762c..2ba7d34d52 100644
--- a/keyboards/handwired/pytest/info.json
+++ b/keyboards/handwired/pytest/info.json
@@ -6,5 +6,7 @@
"vid": "0xFEED",
"pid": "0x6465",
"device_version": "0.0.1"
- }
+ },
+ "processor": "atmega32u4",
+ "bootloader": "atmel-dfu"
}
diff --git a/keyboards/handwired/pytest/macro/rules.mk b/keyboards/handwired/pytest/macro/rules.mk
index 6b42774dbf..e69de29bb2 100644
--- a/keyboards/handwired/pytest/macro/rules.mk
+++ b/keyboards/handwired/pytest/macro/rules.mk
@@ -1 +0,0 @@
-MCU = atmega32u4
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index e0a46e7ed1..637a27b764 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -755,9 +755,6 @@ def arm_processor_rules(info_data, rules):
info_data['processor_type'] = 'arm'
info_data['protocol'] = 'ChibiOS'
- if 'bootloader' not in info_data:
- info_data['bootloader'] = 'unknown'
-
if 'STM32' in info_data['processor']:
info_data['platform'] = 'STM32'
elif 'MCU_SERIES' in rules:
@@ -775,9 +772,6 @@ def avr_processor_rules(info_data, rules):
info_data['platform'] = rules['ARCH'] if 'ARCH' in rules else 'unknown'
info_data['protocol'] = 'V-USB' if rules.get('MCU') in VUSB_PROCESSORS else 'LUFA'
- if 'bootloader' not in info_data:
- info_data['bootloader'] = 'atmel-dfu'
-
# FIXME(fauxpark/anyone): Eventually we should detect the protocol by looking at PROTOCOL inherited from mcu_selection.mk:
# info_data['protocol'] = 'V-USB' if rules.get('PROTOCOL') == 'VUSB' else 'LUFA'
diff --git a/lib/python/qmk/keymap.py b/lib/python/qmk/keymap.py
index f317f4d11e..fc1421962f 100644
--- a/lib/python/qmk/keymap.py
+++ b/lib/python/qmk/keymap.py
@@ -412,7 +412,7 @@ def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=Fa
rules = rules_mk(keyboard)
names = set()
- if rules:
+ if rules is not None:
keyboards_dir = Path('keyboards')
kb_path = keyboards_dir / keyboard
diff --git a/platforms/arm_atsam/bootloader.mk b/platforms/arm_atsam/bootloader.mk
new file mode 100644
index 0000000000..1ec42edeb6
--- /dev/null
+++ b/platforms/arm_atsam/bootloader.mk
@@ -0,0 +1,46 @@
+# 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 for ARM (ATSAM):
+# md-boot Atmel SAM-BA (only used by Drop boards)
+#
+# If you need to provide your own implementation, you can set inside `rules.mk`
+# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See
+# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
+# which functions may be overridden.
+
+ifeq ($(strip $(BOOTLOADER)), custom)
+ OPT_DEFS += -DBOOTLOADER_CUSTOM
+ BOOTLOADER_TYPE = custom
+endif
+
+ifeq ($(strip $(BOOTLOADER)), md-boot)
+ OPT_DEFS += -DBOOTLOADER_MD_BOOT
+ BOOTLOADER_TYPE = md_boot
+endif
+
+ifeq ($(strip $(BOOTLOADER_TYPE)),)
+ ifneq ($(strip $(BOOTLOADER)),)
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ else
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ endif
+endif
diff --git a/builddefs/bootloader.mk b/platforms/avr/bootloader.mk
index 31004cab98..63fe635d96 100644
--- a/builddefs/bootloader.mk
+++ b/platforms/avr/bootloader.mk
@@ -18,9 +18,8 @@
# automatically.
#
# Sets the bootloader defined in the keyboard's/keymap's rules.mk
-# Current options:
#
-# AVR:
+# Current options for AVR:
# halfkay PJRC Teensy
# caterina Pro Micro (Sparkfun/generic)
# atmel-dfu Atmel factory DFU
@@ -29,14 +28,6 @@
# qmk-hid QMK HID (LUFA + blinkenlight)
# bootloadhid HIDBootFlash compatible (ATmega32A)
# usbasploader USBaspLoader (ATmega328P)
-# ARM:
-# halfkay PJRC Teensy
-# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
-# stm32duino STM32Duino (STM32F103x8)
-# stm32-dfu STM32 USB DFU in ROM
-# apm32-dfu APM32 USB DFU in ROM
-# RISC-V:
-# gd32v-dfu GD32V USB DFU in ROM
#
# If you need to provide your own implementation, you can set inside `rules.mk`
# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See
@@ -50,6 +41,7 @@ ifeq ($(strip $(BOOTLOADER)), custom)
OPT_DEFS += -DBOOTLOADER_CUSTOM
BOOTLOADER_TYPE = custom
endif
+
ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
OPT_DEFS += -DBOOTLOADER_DFU
@@ -105,10 +97,6 @@ ifeq ($(strip $(BOOTLOADER)), halfkay)
ifeq ($(strip $(MCU)), at90usb1286)
BOOTLOADER_SIZE = 1024
endif
- # Teensy LC, 3.0, 3.1/2, 3.5, 3.6
- ifneq (,$(filter $(MCU_ORIG), MKL26Z64 MK20DX128 MK20DX256 MK64FX512 MK66FX1M0))
- FIRMWARE_FORMAT = hex
- endif
endif
ifeq ($(strip $(BOOTLOADER)), caterina)
OPT_DEFS += -DBOOTLOADER_CATERINA
@@ -147,77 +135,10 @@ ifdef BOOTLOADER_SIZE
OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
endif
-ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
- OPT_DEFS += -DBOOTLOADER_STM32_DFU
- BOOTLOADER_TYPE = stm32_dfu
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
-endif
-ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
- OPT_DEFS += -DBOOTLOADER_APM32_DFU
- BOOTLOADER_TYPE = stm32_dfu
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 314B -p 0106
-endif
-ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
- OPT_DEFS += -DBOOTLOADER_GD32V_DFU
- BOOTLOADER_TYPE = gd32v_dfu
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
-endif
-ifeq ($(strip $(BOOTLOADER)), kiibohd)
- OPT_DEFS += -DBOOTLOADER_KIIBOHD
- BOOTLOADER_TYPE = kiibohd
-
- ifeq ($(strip $(MCU_ORIG)), MK20DX128)
- MCU_LDSCRIPT = MK20DX128BLDR4
- endif
- ifeq ($(strip $(MCU_ORIG)), MK20DX256)
- MCU_LDSCRIPT = MK20DX256BLDR8
- endif
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS = -d 1C11:B007
- DFU_SUFFIX_ARGS = -v 1C11 -p B007
-endif
-ifeq ($(strip $(BOOTLOADER)), stm32duino)
- OPT_DEFS += -DBOOTLOADER_STM32DUINO
- MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
- BOARD = STM32_F103_STM32DUINO
- BOOTLOADER_TYPE = stm32duino
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS = -d 1EAF:0003 -a 2 -R
- DFU_SUFFIX_ARGS = -v 1EAF -p 0003
-endif
-ifeq ($(strip $(BOOTLOADER)), tinyuf2)
- OPT_DEFS += -DBOOTLOADER_TINYUF2
- BOOTLOADER_TYPE = tinyuf2
- FIRMWARE_FORMAT = uf2
-endif
-ifeq ($(strip $(BOOTLOADER)), rp2040)
- OPT_DEFS += -DBOOTLOADER_RP2040
- BOOTLOADER_TYPE = rp2040
-endif
-ifeq ($(strip $(BOOTLOADER)), halfkay)
- OPT_DEFS += -DBOOTLOADER_HALFKAY
- BOOTLOADER_TYPE = halfkay
-endif
-ifeq ($(strip $(BOOTLOADER)), md-boot)
- OPT_DEFS += -DBOOTLOADER_MD_BOOT
- BOOTLOADER_TYPE = md_boot
-endif
-ifeq ($(strip $(BOOTLOADER)), wb32-dfu)
- OPT_DEFS += -DBOOTLOADER_WB32_DFU
- BOOTLOADER_TYPE = wb32_dfu
-endif
-
ifeq ($(strip $(BOOTLOADER_TYPE)),)
- $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate 'BOOTLOADER' in your keyboard's 'rules.mk' file.)
+ ifneq ($(strip $(BOOTLOADER)),)
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ else
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ endif
endif
diff --git a/platforms/chibios/bootloader.mk b/platforms/chibios/bootloader.mk
new file mode 100644
index 0000000000..0568d35321
--- /dev/null
+++ b/platforms/chibios/bootloader.mk
@@ -0,0 +1,122 @@
+# 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 for ARM:
+# halfkay PJRC Teensy
+# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
+# stm32duino STM32Duino (STM32F103x8)
+# stm32-dfu STM32 USB DFU in ROM
+# apm32-dfu APM32 USB DFU in ROM
+# wb32-dfu WB32 USB DFU in ROM
+# tinyuf2 TinyUF2
+# rp2040 Raspberry Pi RP2040
+# Current options for RISC-V:
+# gd32v-dfu GD32V USB DFU in ROM
+#
+# If you need to provide your own implementation, you can set inside `rules.mk`
+# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See
+# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
+# which functions may be overridden.
+
+ifeq ($(strip $(BOOTLOADER)), custom)
+ OPT_DEFS += -DBOOTLOADER_CUSTOM
+ BOOTLOADER_TYPE = custom
+endif
+
+ifeq ($(strip $(BOOTLOADER)), halfkay)
+ OPT_DEFS += -DBOOTLOADER_HALFKAY
+ BOOTLOADER_TYPE = halfkay
+
+ # Teensy LC, 3.0, 3.1/2, 3.5, 3.6
+ ifneq (,$(filter $(MCU_ORIG), MKL26Z64 MK20DX128 MK20DX256 MK64FX512 MK66FX1M0))
+ FIRMWARE_FORMAT = hex
+ endif
+endif
+ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
+ OPT_DEFS += -DBOOTLOADER_STM32_DFU
+ BOOTLOADER_TYPE = stm32_dfu
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
+endif
+ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
+ OPT_DEFS += -DBOOTLOADER_APM32_DFU
+ BOOTLOADER_TYPE = stm32_dfu
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 314B -p 0106
+endif
+ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
+ OPT_DEFS += -DBOOTLOADER_GD32V_DFU
+ BOOTLOADER_TYPE = gd32v_dfu
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
+endif
+ifeq ($(strip $(BOOTLOADER)), kiibohd)
+ OPT_DEFS += -DBOOTLOADER_KIIBOHD
+ BOOTLOADER_TYPE = kiibohd
+
+ ifeq ($(strip $(MCU_ORIG)), MK20DX128)
+ MCU_LDSCRIPT = MK20DX128BLDR4
+ endif
+ ifeq ($(strip $(MCU_ORIG)), MK20DX256)
+ MCU_LDSCRIPT = MK20DX256BLDR8
+ endif
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS = -d 1C11:B007
+ DFU_SUFFIX_ARGS = -v 1C11 -p B007
+endif
+ifeq ($(strip $(BOOTLOADER)), stm32duino)
+ OPT_DEFS += -DBOOTLOADER_STM32DUINO
+ MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
+ BOARD = STM32_F103_STM32DUINO
+ BOOTLOADER_TYPE = stm32duino
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS = -d 1EAF:0003 -a 2 -R
+ DFU_SUFFIX_ARGS = -v 1EAF -p 0003
+endif
+ifeq ($(strip $(BOOTLOADER)), tinyuf2)
+ OPT_DEFS += -DBOOTLOADER_TINYUF2
+ BOOTLOADER_TYPE = tinyuf2
+ FIRMWARE_FORMAT = uf2
+endif
+ifeq ($(strip $(BOOTLOADER)), rp2040)
+ OPT_DEFS += -DBOOTLOADER_RP2040
+ BOOTLOADER_TYPE = rp2040
+endif
+ifeq ($(strip $(BOOTLOADER)), wb32-dfu)
+ OPT_DEFS += -DBOOTLOADER_WB32_DFU
+ BOOTLOADER_TYPE = wb32_dfu
+endif
+
+ifeq ($(strip $(BOOTLOADER_TYPE)),)
+ ifneq ($(strip $(BOOTLOADER)),)
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ else
+ $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
+ endif
+endif