From a86d6fffc950242f412e05a6a0aed8beede01ba4 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 7 Feb 2022 14:09:21 +1100 Subject: [PATCH] Fixup bootloaders. (#16256) --- keyboards/ducky/one2mini/1861st/1861st.c | 8 ++++++++ keyboards/ducky/one2mini/1861st/rules.mk | 3 +++ keyboards/ergodox_stm32/ergodox_stm32.c | 5 +++++ keyboards/ergodox_stm32/rules.mk | 3 +++ keyboards/jm60/jm60.c | 5 +++++ keyboards/jm60/rules.mk | 3 +++ keyboards/matrix/abelx/abelx.c | 5 +++++ keyboards/matrix/abelx/rules.mk | 3 +++ keyboards/matrix/m12og/rev1/rev1.c | 5 +++++ keyboards/matrix/m12og/rev1/rules.mk | 3 +++ keyboards/matrix/m20add/m20add.c | 5 +++++ keyboards/matrix/m20add/rules.mk | 3 +++ keyboards/matrix/noah/noah.c | 5 +++++ keyboards/matrix/noah/rules.mk | 3 +++ keyboards/wolfmarkclub/wm1/rules.mk | 3 +++ keyboards/wolfmarkclub/wm1/wm1.c | 5 +++++ keyboards/xiaomi/mk02/rules.mk | 3 +++ 17 files changed, 70 insertions(+) create mode 100644 keyboards/ducky/one2mini/1861st/1861st.c diff --git a/keyboards/ducky/one2mini/1861st/1861st.c b/keyboards/ducky/one2mini/1861st/1861st.c new file mode 100644 index 0000000000..1c164ea70d --- /dev/null +++ b/keyboards/ducky/one2mini/1861st/1861st.c @@ -0,0 +1,8 @@ +// Copyright 2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "1861st.h" + +void bootloader_jump(void) { + // TODO: Work out how to jump to LDROM, for now just reset the board. + NVIC_SystemReset(); +} diff --git a/keyboards/ducky/one2mini/1861st/rules.mk b/keyboards/ducky/one2mini/1861st/rules.mk index 277108c8ac..a5b4708b26 100644 --- a/keyboards/ducky/one2mini/1861st/rules.mk +++ b/keyboards/ducky/one2mini/1861st/rules.mk @@ -1,6 +1,9 @@ MCU_FAMILY = NUMICRO MCU_SERIES = NUC123 +# Bootloader selection +BOOTLOADER = custom + # linker script to use MCU_LDSCRIPT = NUC123xD4xx0 diff --git a/keyboards/ergodox_stm32/ergodox_stm32.c b/keyboards/ergodox_stm32/ergodox_stm32.c index 846c29d7a4..8419b40f41 100644 --- a/keyboards/ergodox_stm32/ergodox_stm32.c +++ b/keyboards/ergodox_stm32/ergodox_stm32.c @@ -16,6 +16,11 @@ void board_init(void) { AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; } +void bootloader_jump(void) { + // This board doesn't use the "standard" stm32duino bootloader, and is resident in memory at the base location. All we can do here is reset. + NVIC_SystemReset(); +} + void matrix_init_kb(void) { // Init LED Ports diff --git a/keyboards/ergodox_stm32/rules.mk b/keyboards/ergodox_stm32/rules.mk index 3f7197cbf6..e730df82aa 100644 --- a/keyboards/ergodox_stm32/rules.mk +++ b/keyboards/ergodox_stm32/rules.mk @@ -3,6 +3,9 @@ MCU = STM32F103 MCU_LDSCRIPT = stm32f103_bootloader BOARD = ST_NUCLEO64_F103RB +# Bootloader selection +BOOTLOADER = custom + BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control diff --git a/keyboards/jm60/jm60.c b/keyboards/jm60/jm60.c index f7b434f30e..823892dce9 100644 --- a/keyboards/jm60/jm60.c +++ b/keyboards/jm60/jm60.c @@ -20,3 +20,8 @@ along with this program. If not, see . void board_init(void) { AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; } + +void bootloader_jump(void) { + // This board doesn't use the "standard" stm32duino bootloader. There's no information on how to jump to the custom bootloader, so all we can do here is reset. + NVIC_SystemReset(); +} diff --git a/keyboards/jm60/rules.mk b/keyboards/jm60/rules.mk index 6cb13d932d..c6de64a130 100644 --- a/keyboards/jm60/rules.mk +++ b/keyboards/jm60/rules.mk @@ -4,6 +4,9 @@ MCU = STM32F103 MCU_LDSCRIPT = jm60_bootloader BOARD = ST_NUCLEO64_F103RB +# Bootloader selection +BOOTLOADER = custom + # Build Options # change yes to no to disable # diff --git a/keyboards/matrix/abelx/abelx.c b/keyboards/matrix/abelx/abelx.c index 77e749ee40..9585948e0c 100644 --- a/keyboards/matrix/abelx/abelx.c +++ b/keyboards/matrix/abelx/abelx.c @@ -97,3 +97,8 @@ void shutdown_user(void) // set the magic number for resetting to the bootloader *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; } + +void bootloader_jump(void) { + shutdown_user(); + NVIC_SystemReset(); +} diff --git a/keyboards/matrix/abelx/rules.mk b/keyboards/matrix/abelx/rules.mk index d4a065662b..7a5d01e5cb 100644 --- a/keyboards/matrix/abelx/rules.mk +++ b/keyboards/matrix/abelx/rules.mk @@ -25,6 +25,9 @@ ARMV = 7 USE_FPU = yes +# Bootloader selection +BOOTLOADER = custom + # Build Options # change yes to no to disable # diff --git a/keyboards/matrix/m12og/rev1/rev1.c b/keyboards/matrix/m12og/rev1/rev1.c index e3277bee27..53183c7d2d 100644 --- a/keyboards/matrix/m12og/rev1/rev1.c +++ b/keyboards/matrix/m12og/rev1/rev1.c @@ -20,6 +20,11 @@ void board_init(void) { writePinLow(A8); } +void bootloader_jump(void) { + // This board doesn't use the standard DFU bootloader, and no information is available regarding how to enter bootloader mode. All we can do here is reset. + NVIC_SystemReset(); +} + void keyboard_post_init_kb(void) { rgblight_enable_noeeprom(); rgblight_sethsv_noeeprom(5, 255, 255); diff --git a/keyboards/matrix/m12og/rev1/rules.mk b/keyboards/matrix/m12og/rev1/rules.mk index 0e0584b8c9..d9733e8c5e 100644 --- a/keyboards/matrix/m12og/rev1/rules.mk +++ b/keyboards/matrix/m12og/rev1/rules.mk @@ -5,6 +5,9 @@ MCU_LDSCRIPT = m12og_v1 BOARD = m12og_v1 +# Bootloader selection +BOOTLOADER = custom + # Build Options # change yes to no to disable # diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c index 4d328d6c54..cdcafb9779 100644 --- a/keyboards/matrix/m20add/m20add.c +++ b/keyboards/matrix/m20add/m20add.c @@ -59,3 +59,8 @@ void shutdown_user(void) // set the magic number for resetting to the bootloader *(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC; } + +void bootloader_jump(void) { + shutdown_user(); + NVIC_SystemReset(); +} diff --git a/keyboards/matrix/m20add/rules.mk b/keyboards/matrix/m20add/rules.mk index 1ecbd9d308..86bd6b9371 100644 --- a/keyboards/matrix/m20add/rules.mk +++ b/keyboards/matrix/m20add/rules.mk @@ -10,6 +10,9 @@ MCU_LDSCRIPT = m20add_boot # or /boards BOARD = ST_NUCLEO64_F411RE +# Bootloader selection +BOOTLOADER = custom + # Build Options # change yes to no to disable # diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c index 2143dee3be..89c25707af 100644 --- a/keyboards/matrix/noah/noah.c +++ b/keyboards/matrix/noah/noah.c @@ -4,6 +4,11 @@ #include "noah.h" +void bootloader_jump(void) { + // This board doesn't use the standard DFU bootloader, and no information is available regarding how to enter bootloader mode. All we can do here is reset. + NVIC_SystemReset(); +} + #ifdef RGBLIGHT_ENABLE #include #include "rgblight.h" diff --git a/keyboards/matrix/noah/rules.mk b/keyboards/matrix/noah/rules.mk index b9f642e8cd..7971d628d6 100644 --- a/keyboards/matrix/noah/rules.mk +++ b/keyboards/matrix/noah/rules.mk @@ -10,6 +10,9 @@ MCU_LDSCRIPT = noah_boot # or /boards BOARD = ST_NUCLEO64_F411RE +# Bootloader selection +BOOTLOADER = custom + # Build Options # change yes to no to disable # diff --git a/keyboards/wolfmarkclub/wm1/rules.mk b/keyboards/wolfmarkclub/wm1/rules.mk index 2782d497ce..a712747048 100644 --- a/keyboards/wolfmarkclub/wm1/rules.mk +++ b/keyboards/wolfmarkclub/wm1/rules.mk @@ -5,6 +5,9 @@ MCU = STM32F103 MCU_LDSCRIPT = wm1_f103 BOARD = STM32_F103_STM32DUINO +# Bootloader selection +BOOTLOADER = custom + PROGRAM_CMD = echo 'CLI flashing not supported' >&2 # Build Options diff --git a/keyboards/wolfmarkclub/wm1/wm1.c b/keyboards/wolfmarkclub/wm1/wm1.c index d199546f89..0ad1ade4cc 100644 --- a/keyboards/wolfmarkclub/wm1/wm1.c +++ b/keyboards/wolfmarkclub/wm1/wm1.c @@ -1,5 +1,10 @@ #include "wm1.h" +void bootloader_jump(void) { + // This board doesn't use the "standard" stm32duino bootloader, and no information is available regarding how to enter bootloader mode. All we can do here is reset. + NVIC_SystemReset(); +} + void matrix_init_kb(void) { setPinOutput(B1); // Top Indicator LED setPinOutput(B0); // Middle Indicator LED diff --git a/keyboards/xiaomi/mk02/rules.mk b/keyboards/xiaomi/mk02/rules.mk index 9d6d62c394..c20d67dd89 100644 --- a/keyboards/xiaomi/mk02/rules.mk +++ b/keyboards/xiaomi/mk02/rules.mk @@ -3,6 +3,9 @@ MCU = STM32F072 BOARD = ST_STM32F072B_DISCOVERY MCU_LDSCRIPT = STM32F072_0x2000_bootloader +# Bootloader selection +BOOTLOADER = custom + DFU_ARGS = -d 0483:df11 -a 0 -s 0x08002000:leave DFU_SUFFIX_ARGS = -v 0483 -p DF11